public class KthSelector extends Object implements Serializable
Constructor and Description |
---|
KthSelector()
Constructor with default
median of 3 pivoting strategy |
KthSelector(PivotingStrategyInterface pivotingStrategy)
Constructor with specified pivoting strategy
|
Modifier and Type | Method and Description |
---|---|
PivotingStrategyInterface |
getPivotingStrategy()
Get the pivotin strategy.
|
double |
select(double[] work,
int[] pivotsHeap,
int k)
Select Kth value in the array.
|
public KthSelector()
median of 3
pivoting strategypublic KthSelector(PivotingStrategyInterface pivotingStrategy) throws NullArgumentException
pivotingStrategy
- pivoting strategy to useNullArgumentException
- when pivotingStrategy is nullMedianOf3PivotingStrategy
,
RandomPivotingStrategy
,
CentralPivotingStrategy
public PivotingStrategyInterface getPivotingStrategy()
public double select(double[] work, int[] pivotsHeap, int k)
work
- work array to use to find out the Kth valuepivotsHeap
- cached pivots heap that can be used for efficient estimationk
- the index whose value in the array is of interestCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.