Binary tree to double linked list
Problem Statement
Given a Binary Tree, your task is to convert it to a Doubly Linked List. The left and right pointers in nodes are to be used as previous and next pointers respectively in converted Double linked list. The order of nodes in Double linked list must be same as Inorder of the given Binary Tree. The first node of Inorder traversal (left most node in Binary tree) must be head node of the Doubly linked list.
Input
User Task:
Since this will be a functional problem. You don't have to take input. You just have to complete the function BToDLL() that takes "root" node of binary tree as parameter.
Constraint:-
1 <= Number of Nodes <= 1000
1 <= Node.data <= 1000
Output
The printing is done by the driver code you just need to complete the function.
Comments
Leave a comment