Given a node in a binary tree find the next greatest value in the entire node.
Respuestas de entrevistas
Anónimo
24 feb 2012
I guess it is a binary search tree? And does each node have a parent pointer?
Anónimo
6 mar 2012
for BST : get the node and find the inorder successor
if(n->right) : find minimum in n->right
else
find parent of n in loop, till n is parent->right :
(n = parent, find parent(n)