This question is for 15 points please help me on the solutio
This question is for 15 points, please help me on the solution
Given an element x in an n. node order statistic tree and a natural number i, how can we determine the ith successor of x in the linear order of the tree in O(lg n) time?Solution
For this our data structure should have these 2 operations:
1) Get(i)-which gives the key at ith position of the total order of keys
2) Rank(x)- which gives the position of x in total order of keys
Now we work on this Get(Rank(x) + i)
In an order statistic tree, each and every node x keeps the record of the number of nodes contained in the subtree rooted in x.
Using these 2 operations will keep the track of no. of nodes lie to the left of our path
