Median of two AVL trees | Sololearn: Learn to code for FREE!


Median of two AVL trees

Hello fellow coders! I have been given this task and have been trying to figure out a solution but can’t seem to wrap my head around it. If we have two AVL trees and we would want to find the median of all of the integers in the trees how can we do it in O(log n) time where n is the total number of values. Ps. Each node can store the number of nodes of its subtree Any help would be appreciated Thanks a lot 🥰

4/8/2020 1:57:37 PM


1 Answer

New Answer


Pintu Kumar we need to find the median of the two trees not just one