Pergunta de entrevista da empresa Google

Write pseudo code for a Binary Search tree

Respostas da entrevista

Sigiloso

19 de out. de 2010

I'm not going to write the code here but the function for a BST are: Insert Delete Find Traverse The only tricky part is the delete function where you are asked to delete a node which has both left and right children,you should swap the value of the node with the leftmost value of the right child and delete the leftmost right child (even if that child has a right child its not a big deal)

1

Sigiloso

12 de dez. de 2010

Here is a good article with working code in Java and C++ and nice diagrams: http://www.algolist.net/Data_structures/Binary_search_tree/Internal_repr