Question: Consider distinct numbers x 1 ,,x n each also with a positive weight w 1 ,,w n such that . The weighted median is the
Consider distinct numbers x1,,xn each also with a positive weight w1,,wn such that
. The weighted median is the item xk that satisfies
and
a) Show how to compute the weighted median of n items in worst case time O(nlogn) using sorting. Provide the algorithm and the efficiency analysis.
b) Show how to compute the weighted median in worst case time O(n) using a linear time median-finding algorithm as a black-box. Provide the algorithm and the efficiency analysis.
\ u, = \ u, =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
