Friday, February 24, 2012

Binary Tree to Doubly Linked List.

Write code to convert a binary tree to doubly link list in place.


Code input/output:


Inserting following values in BST: 
98 84 92 58 57 20 34 
Printing BST inorder: 
20 34 57 58 84 92 98 
Printing the doubly linked list: 
20 <-> 34 <-> 57 <-> 58 <-> 84 <-> 92 <-> 98 <->  points to head 

No comments:

Post a Comment