diff --git a/src/data-structures/tree/red-black-tree/RedBlackTree.js b/src/data-structures/tree/red-black-tree/RedBlackTree.js index d00a6730..2bd3afd4 100644 --- a/src/data-structures/tree/red-black-tree/RedBlackTree.js +++ b/src/data-structures/tree/red-black-tree/RedBlackTree.js @@ -32,6 +32,14 @@ export default class RedBlackTree extends BinarySearchTree { return insertedNode; } + /** + * @param {*} value + * @return {BinarySearchTreeNode} + */ + remove(value) { + throw new Error(`Can't remove ${value}. Remove method is not implemented yet`); + } + /** * @param {BinarySearchTreeNode} node */ diff --git a/src/data-structures/tree/red-black-tree/__test__/RedBlackTree.test.js b/src/data-structures/tree/red-black-tree/__test__/RedBlackTree.test.js index c26763e3..cf5a54c4 100644 --- a/src/data-structures/tree/red-black-tree/__test__/RedBlackTree.test.js +++ b/src/data-structures/tree/red-black-tree/__test__/RedBlackTree.test.js @@ -311,4 +311,14 @@ describe('RedBlackTree', () => { expect(tree.toString()).toBe('15,17,19,20,25'); expect(tree.root.height).toBe(2); }); + + it('should throw an error when trying to remove node', () => { + const removeNodeFromRedBlackTree = () => { + const tree = new RedBlackTree(); + + tree.remove(1); + }; + + expect(removeNodeFromRedBlackTree).toThrowError(); + }); });