Find the no. of elements on the left side. If it is n-1 the root is the median. If it is more than n-1, then it has already been found in the left subtree. Else it should be in the right subtree.

Its better to count all the elements in the tree in one traversal and then use inorder traversal to print the n/2th element in second traversal.

How do you apply Binary Search on 2D array supposed you have 2D array with integers sorted both horizontally and vertically. If you find any occurrence of the value you are looking for you return true else false. What is the complexity?

For example the 2D array could look like the following