If one has a set, S, of n items, where n is even, then the median item

Question:

If one has a set, S, of n items, where n is even, then the median item in S is the average of the ith and (i + 1)st smallest elements in S, where i = n/2. Describe an efficient algorithm for computing the median of such a set S that is stored in a binary search tree, T, where each node, v, in T is augmented with a count, nv, which stores the number of items stored in the subtree of T rooted at v.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Algorithm Design And Applications

ISBN: 9781118335918

1st Edition

Authors: Michael T. Goodrich, Roberto Tamassia

Question Posted: