Pergunta de entrevista da empresa Google

Given a node in a binary tree find the next greatest value in the entire node.

Respostas da entrevista

Sigiloso

24 de fev. de 2012

I guess it is a binary search tree? And does each node have a parent pointer?

Sigiloso

6 de mar. de 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)