File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ key is not present in this tree.
43
43
#### insert(key, value)
44
44
45
45
Inserts the given key, value pair in this tree. Creates a new node with the
46
- given key and value and inserts it in the appropriate position. Throws an
47
- exception if the given key is already present in this tree.
46
+ given key and value and inserts it in the appropriate position. Returns the
47
+ created node. Throws an exception if the given key is already present in this
48
+ tree.
48
49
49
50
#### remove(key)
50
51
@@ -112,7 +113,8 @@ Returns null if there is no such node.
112
113
113
114
Inserts the given key, value pair in the subtree rooted at this node. Creates
114
115
a new node with the given key and value and inserts it in the appropriate
115
- position. Throws an exception if the given key is already in this subtree.
116
+ position. Returns the created node. Throws an exception if the given key is
117
+ already in this subtree.
116
118
117
119
#### remove()
118
120
Original file line number Diff line number Diff line change @@ -131,7 +131,8 @@ BinarySearchTree.prototype.Node.prototype.get = function (key) {
131
131
132
132
/* Inserts the given key, value pair in the subtree rooted at this node. Creates
133
133
* a new node with the given key and value and inserts it in the appropriate
134
- * position. Throws an exception if the given key is already in this subtree.
134
+ * position. Returns the created node. Throws an exception if the given key is
135
+ * already in this subtree.
135
136
*/
136
137
BinarySearchTree . prototype . Node . prototype . insert = function ( key , value ) {
137
138
for ( var currNode = this ; true ; ) {
@@ -289,8 +290,9 @@ BinarySearchTree.prototype.get = function (key) {
289
290
} ;
290
291
291
292
/* Inserts the given key, value pair in this tree. Creates a new node with the
292
- * given key and value and inserts it in the appropriate position. Throws an
293
- * exception if the given key is already present in this tree.
293
+ * given key and value and inserts it in the appropriate position. Returns the
294
+ * created node. Throws an exception if the given key is already present in this
295
+ * tree.
294
296
*/
295
297
BinarySearchTree . prototype . insert = function ( key , value ) {
296
298
if ( this . root === null ) {
You can’t perform that action at this time.
0 commit comments