link mingle home | logged in as: guest | login/register| submit link


IndiaDiscuss.com : Social Bookmarkings and News Networking Site for India
interview_questions
Bookmarks
Circular Link List from a Given Binary Tree
42
Votes

Create a Circular Link List from a Given Binary Tree

saved under Microsoft Interview Questions by interview_questions

 
 1. Do a post-order traversal
 2. Whenever you print the node, you can remove it and add to the current linked list.

comment by search on 2008-06-27 02:32:50
Another efficient way using o(1) space. Use two pointers say current and tail. 1. Set current and tail to root. 2. Add left and right to tail pointer. 3. Increment current pointer. 4. If current reached end, break, else repeat from step2 2.
comment by aravinds03 on 2010-10-02 09:24:04
 



Enter the string above
 
IndiaDiscuss | Published News | Hot
Indian Social News and Links Network
IndiaDiscuss | Published News
Indian Social News and Links Network