Skip to content

Commit 85934d3

Browse files
committed
bst to double linked list
1 parent d3ce69e commit 85934d3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

PuzzleCoding/src/BSTtoDLL.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ public static void bstToDll1(Node p) {
8282

8383
bstToDll1(p.left);
8484
p.left = prev;
85+
// current node (smallest element) is head of
86+
// the list if previous node is not available
8587
if (prev == null){
8688
tail = p;
8789
}
8890
else{
89-
// current node (smallest element) is head of
90-
// the list if previous node is not available
91+
9192
prev.right = p;
9293
}
9394

0 commit comments

Comments
 (0)