Skip to content

Commit e17a272

Browse files
authored
repair recursiveReverse bug
The prev reference error of the node after the iteration is called.
1 parent 3eee560 commit e17a272

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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)