Given a binary tree convert it into a doubly linked list in place. In-place means that for a node, right pointer should point to the in-order successor and left pointer should point to the in-order predecessor.
12 15 will be converted to 25 <--> 12 <-->30 <--> 10 <--> 36 <--15>
/ \ /
25 30 36
This problem can be easily modelled into a recursive problem.
For every node, assume that the left sub-tree has been connected in a doubly linked list. In that case, the current node will extend that doubly linked list and pass it to its in-order successor.
We can traverse the binary tree in in-order manner and at the same time can keep connecting the
pointers in such a manner that the previous node in the in-order traversal is contained as the tail and the current node will be the new tail of the double linked