-
Notifications
You must be signed in to change notification settings - Fork 1
Order statistics
-
Exercises 9.1-2: Find the second smallest of
n
elements. (n + ceiling(lgn) - 2
comparisons in the worst case) -
RANDOMIZED-SELECT: divide and conquer using RANDOMIZED-PARTITION. average:
Theta(nlgn)
, worst:n^2
-
SELECT: divide the array into
floor(n/5)
groups of 5 elements each and find median of each group using insertion sort; use SELECT recursively to find the medianx
of these medians; partition the input array around the median-of-mediansx
; use SELECT recessively on one side of the partition -
Exercises 9.3-6: list the kth quantiles of a set in
O(nlgk)
. (use divide and conquer) -
Exercises 9.3-8: find the median of two
n
elements sorted arrays inO(lgn)
. (cut the smaller and larger quarters each time) -
Problem 9-2: post-office location problems in 1-dimension and two dimensions (in Manhattan distance)