Return removed nodes in BST.

This commit is contained in:
Oleksii Trekhleb
2018-05-31 08:29:59 +03:00
parent 7a4265403c
commit f04626bc5c
3 changed files with 17 additions and 7 deletions

View File

@@ -10,9 +10,10 @@ export default class BinarySearchTree {
/**
* @param {*} value
* @return {BinarySearchTreeNode}
*/
insert(value) {
this.root.insert(value);
return this.root.insert(value);
}
/**
@@ -25,6 +26,7 @@ export default class BinarySearchTree {
/**
* @param {*} value
* @return {BinarySearchTreeNode}
*/
remove(value) {
return this.root.remove(value);