Convert any BST into doubly linked list in place

Go down

Convert any BST into doubly linked list in place

Post  Admin on Thu Nov 17, 2011 5:44 pm


public LinkedListNode convert(Node root, LinkedListNode head){
if(root==null)
return head;
convert(root.left, head);
LinkedListNode temp=new LinkedListNode(root);
head.next=temp;
temp.previous=head;
temp.next=null;
convert(root.right,head);
}

Admin
Admin

Posts : 131
Join date : 2011-08-16

View user profile http://codefornongeek.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum