Programming Algorithms Question:

How to find median of a BST?

Tweet Share WhatsApp

Answer:

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.

Download Programming Algorithms PDF Read All 30 Programming Algorithms Questions
Previous QuestionNext Question
Define string in an algorithmic notation and an example to support it?What are the arguments present in pattern matching algorithms?