Median of two AVL trees | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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 🥰

8th Apr 2020, 1:57 PM
Amany
1 Answer
0
Pintu Kumar we need to find the median of the two trees not just one
8th Apr 2020, 2:34 PM
Amany