Thanks for your helpful answer Consider a class E having two
Thanks for your helpful answer?
Consider a class E having two attributes (of float type): E.v = value E.w = weight Suppose that you are given with an array of instances of E: D = {e_1, e_12, ..., e_n}. Also assume that sigma^n_ i = 1 e_i, w = 1. The q-quantile is the element e_k satisfying Describe (in a pseudo-code) a recursive algorithm to find the q-quantile of n elements.Solution
You start with KTH-QUANTILES(A, 1, n, 1, k-1, k)
The depth of the recursion tree is lg k, since the partition is done around the median of the given order statistics (from i to j).
On each level of the recursion tree there are (n) operations, so the running time is (nlgk).
