I also encountered this question yesterday. This is my solution which i 
tested for a few sample cases.

https://github.com/algoseeker/Interview/blob/master/Node.java

I maintained a pointer to the Node where there should be creation of a new 
node. If the node created is left child, shift the pointer to new node 
created. If this new Node's right child gets created, shift the pointer to 
the parent of this Node.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to