|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.mhhe.clrs2e.RandomizedSelect
Implements the OrderStatistics interface via the
Randomized-Select procedure (which runs in linear expected time)
from page 186 of Introduction to Algorithms, Second
edition.
| Field Summary | |
private com.mhhe.clrs2e.RandomizedPartitioner |
part
For partitioning. |
| Constructor Summary | |
RandomizedSelect()
Sets the partitioner to be a randomized one. |
|
| Method Summary | |
private java.lang.Comparable |
randomizedSelect(java.lang.Comparable[] array,
int p,
int r,
int i)
Returns the ith smallest element in a subarray array[p..r]. |
java.lang.Comparable |
select(java.lang.Comparable[] array,
int i)
Returns the ith smallest element in an array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private com.mhhe.clrs2e.RandomizedPartitioner part
| Constructor Detail |
public RandomizedSelect()
| Method Detail |
private java.lang.Comparable randomizedSelect(java.lang.Comparable[] array,
int p,
int r,
int i)
array[p..r].
array - The array containing the subarray to be sorted.p - Index of the beginning of the subarray.r - Index of the end of the subarray.i - Which order statistic we want.
public java.lang.Comparable select(java.lang.Comparable[] array,
int i)
select in interface OrderStatisticsarray - The array.i - Which order statistic we want.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||