Find median of elements of a Binary Search tree in O(log n)
You can't, until you have additional information regarding the number of elements in the subtree rooted at every node.
Avi
Avi Dullu's Code Arena
convert BST TO DLL and then find the middle element... but its O(n)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks