Saturday, January 6, 2018

Binary search tree inorder successor

January 6, 2018

Introduction


I met a peer on 12:00 PM mock interview. We discussed the algorithm and then the peer wrote some code.

Here is the transcript. The peer told me that he is working on this February Google onsite interview, when I gave appraise his code for the algorithm. He wrote in less than 10 minutes after I gave the hint about recursive solution. He said that he liked to write an iterative one.

Make it more readable



One thing I did very good as an interviewer is to put the drawing inside sharecode.io, and also write down the inorder traversal of tree, mark the root node and also using g to mark given node position, first case is the same as root node, second one is the right side of root node, and the third one is left side of root node.

The whole presentation of the problem is much more readable and easy to work on. I am becoming more experience to give the peer an interview.

Now it is 7:46 PM, and I like to upload the link with more readable problem statement on github for this binary search tree inorder successor. Here is the link.

No comments:

Post a Comment