Amazon interview question

Write an algorithm to find the minimum-depth of a binary tree.

Interview Answer

Anonymous

27 Jul 2011

int minOfTwo (int nb1, int nb2) { return ((!nb1 && !nb2) ? nb1 : ((nb1 leftSubTree), minDepth(nptr->rightSubTree)); }

1