let n, the size of the combined be trees be odd and assume that all the integers across the trees are distinct. Take these two AVL trees as input and find the median of the trees in O(log(n)) time.
I've tried and the best I can get is O(log²(n)) time. This is by using a solution algorithm that imitates this question but instead uses two sorted arrays U-tube: Binary Search : Median of two sorted arrays of different sizes.
Could someone please help me find a solution in O(log(n)), and if you provide code, python would be much appreciated!
Edit: Each node stores the size of the subtree rooted at that node.