Question: 7 . For n distinct elements with positive weights x 1 , x 2 , . . . , xn with positive weights w 1
For n distinct elements with positive weights x x xn with positive weights w w wn such that
inwi the weighted lower median is the element xk such that
xixk wi
Observe that the median of x x xn is the weighted median for wi n for i n
a Show how to compute the weighted median of n elements in On log n worst case time using sorting. You do not need to write pseudocode, simply explain your approach and justify the claim for its complexity.
b Show how to compute the weighted median in On time using the Select algorithm discussed in class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
