Problem:
Convert binary search tree to doubly linked list
Solution:
– Traverse InOrder
– Keep TailPointer
– And update following things for each root
– – root.left = tail
– – tail.right = root
– – tail = root
Latest Source Code:
Github: BinarySearchTreeToDoublyLinkedList.java
Output:
6 / \ / \ / \ / \ -13 14 \ / \ \ / \ -8 13 15 / 7 Forward: -13 -8 6 7 13 14 15 Backward: 15 14 13 7 6 -8 -13