Saturday, January 20, 2018

Binary search tree inorder successor

January 20, 2018


Introduction


It is 10:00 AM mock interview. After the interview, I gave the peer to solve three algorithm. This algorithm I like to test how good the peer is confident on recursive solution. But the peer explained it to me that the iterative solution he writes, why he likes to write iterative one instead of recursive one. He solved it in less than 10 minutes, because both of us like to move on the next mock interview, and also we moved to appear.in to get audio and video, use codeshare.io to get coding editor.

Algorithm code review


Here is the pseudo code the peer wrote in less than 10 minutes. I explained to him that his original code has a bug. If the given node is the node with value 14, the successor should be 20 instead of 12.


No comments:

Post a Comment