Interview Questions

186. How do you test a function which would return the second smallest number in a BST?

Microsoft Interview Questions and Answers


(Continued from previous question...)

186. How do you test a function which would return the second smallest number in a BST?

Question:
How do you test a function which would return the second smallest number in a BST?


maybe an answer:


1) Dont give it a BST
2) Let BST be null
3) Let there be only 1 element
4) Let there be 2 elements (valid case)
5) let there be n elements where n > 2
6) let there be numbers where 2nd smallest is parent of the smallest
7) let there be numbers wehre 2nd smallest is child of smallest
8) let there be numbers where 2nd smallest is child of child of smallest

(Continued on next question...)

Other Interview Questions