Tripadvisor interview question

Given a binary search tree, set up a variable in each node that points to its right neighbor.

Interview Answers

Anonymous

6 Apr 2013

Right neighbor may not have the same parent.

Anonymous

18 May 2013

Would you mind elaborate the question a bit? Is it about finding the nearest node on the right hand-side? (So, its right sibling would be the first choice, but if none exists, move up one level and keep looking, somehting like that?)