Code For NonGeek
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Convert any BST into doubly linked list in place

Go down

Convert any BST into doubly linked list in place Empty Convert any BST into doubly linked list in place

Post  Admin 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

https://codefornongeek.forumotion.com

Back to top Go down

Back to top


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