Programming Algorithms Question:
Download Job Interview Questions and Answers PDF
How to find median of a BST?
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.
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 Interview Questions And Answers
PDF
Previous Question | Next Question |
Define string in an algorithmic notation and an example to support it? | What are the arguments present in pattern matching algorithms? |