Sunday, March 4, 2018

Clone a binary tree with a random pointer

March 4, 2018

Introduction


It is such a big surprise that I had a mock interview this Saturday 8 PM. The peer gave me the algorithm to work on, clone a binary tree with a random pointer.


Code practice


Here is the transcript for my mock interview. I did make mistake and did not handle the random pointer properly.

I should not apply recursive function on random pointer since it will end up a dead loop.





No comments:

Post a Comment