wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> microsoft >> flatten binary search tree into doubly linked list
(Message started by: sanny on Dec 3rd, 2008, 1:32am)

Title: flatten binary search tree into doubly linked list
Post by sanny on Dec 3rd, 2008, 1:32am
flatten a linked binary search tree into a sorted doubly linked list, without using any extra space.
You have to do this by only modifying the pointers, that is your links to leftchild or rightchild in tree beomes your forward or backward pointer in doubly linked list.

Title: Re: flatten binary search tree into doubly linked
Post by towr on Dec 3rd, 2008, 2:04am
It was asked before here (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_cs;action=display;num=1217501857;), among other places.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board