Tripadvisor Interview Question

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

Interview Answers

Anonymous

Apr 6, 2013

Right neighbor may not have the same parent.

Anonymous

May 18, 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?)