Randomized Algorithms
Last updated
Was this helpful?
Last updated
Was this helpful?
This section concerns about the ith order statistic selection problem and many other significant yet practical randomized algorithms.
A computation task described as follows: Find the ith smallest element (also termed as the ) in a randomly distributed array.
In a more general question that to locate a median within a randomly distributed array, the fundamental idea of is also useful, contributing in partition method as well.
The average running time of RANDOMIZED SELECTION is Ο(n) for every possible input length n.
Proof:
Define a phase j where the set of pivot choices lies between the size of n ⋅ (3/4)j+1 and n ⋅ (3/4)j (in each iteration, choosing a central element that has 1/4 elements smaller than it and 1/4 elements larger than it makes the next length at least 3/4 of the current length).
It takes 50-50 to choose a random splitter that has a 25-75 split and thus E(X) = 1 + 1/2 ⋅ E(X), E(X) = 2, where X is number of iterations before central element is found.
E(Τ(n)) = cn ∑ (3/4)j ⋅ E(Xj); E(Τ(n)) ⩽ 2 cn ∑ (3/4)j = 8 cn
Then, the average running time is Ο(n), proof ends.
Then, by ,
A algorithm aims to swiftly sort the un-ordered elements in the array. With a randomized pivot selection method (borrowed from the idea of ) introduced to the phase of choosing pivot of partition method, will have an efficiency of Ο(n ⋅ log n) in the expected running time.