Question d’entretien chez Google

Write pseudo code for a Binary Search tree

Réponses aux questions d'entretien

Utilisateur anonyme

19 oct. 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

Utilisateur anonyme

12 déc. 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