Tuesday, June 16, 2015

Binary Tree Search Solution

I hate face2face interview problems. I am horrible at them. I need the mental space of the IDE to work out the problem and think about it, something I dont do well in interviews.

Ah the classic interview question. Recurse Binary Trees. I don't know why they just love to give this one but I have some time off so I thought I would solve it. This is for a github project where I will point interviewers at so maybe they will just believe I can do this stuff.

The key to this is to check the other node in the recursion of the find or it will go down the right or left leg and get lost. There are some good Data Structures articles on BTS that I used to come to this solution. Here you go: