UBS Interview Question

Coding question on binary search tree .