Skip to content

Commit 53256ef

Browse files
committed
Merge branch 'master' of github.com:mgechev/javascript-algorithms
* 'master' of github.com:mgechev/javascript-algorithms: Fixed _existsInSubtree comparison of nodes' values bug. repair recursiveReverse bug
2 parents 45de167 + 2aded16 commit 53256ef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/data-structures/binary-search-tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@
455455
if (!root) {
456456
return false;
457457
}
458-
if (node === root.value) {
458+
if (node.value === root.value) {
459459
return true;
460460
}
461461
return this._existsInSubtree(node, root._left) ||

src/data-structures/linked-list.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,15 @@
235235
return;
236236
}
237237
inverse(next, next.next);
238+
next.prev = next.next;
238239
next.next = current;
239240
}
240241

241242
if (!this.first) {
242243
return;
243244
}
244245
inverse(this.first, this.first.next);
246+
this.first.prev = this.first.next;
245247
this.first.next = null;
246248
var temp = this.first;
247249
this.first = this.last;

0 commit comments

Comments
 (0)