public class QuickSelect
extends java.lang.Object
The most common use of selection is in the statistical characterization of a set of data. One often wants to know the median element (quantile p = 1/2) in an array or the top and bottom quartile elements (quantile p = 1/4, 3/4).
| Modifier and Type | Method and Description |
|---|---|
static double |
median(double[] a)
Find the median of an array of type double.
|
static float |
median(float[] a)
Find the median of an array of type float.
|
static int |
median(int[] a)
Find the median of an array of type integer.
|
static <T extends java.lang.Comparable<? super T>> |
median(T[] a)
Find the median of an array of type double.
|
static double |
q1(double[] a)
Find the first quantile (p = 1/4) of an array of type double.
|
static float |
q1(float[] a)
Find the first quantile (p = 1/4) of an array of type float.
|
static int |
q1(int[] a)
Find the first quantile (p = 1/4) of an array of type integer.
|
static <T extends java.lang.Comparable<? super T>> |
q1(T[] a)
Find the first quantile (p = 1/4) of an array of type double.
|
static double |
q3(double[] a)
Find the third quantile (p = 3/4) of an array of type double.
|
static float |
q3(float[] a)
Find the third quantile (p = 3/4) of an array of type float.
|
static int |
q3(int[] a)
Find the third quantile (p = 3/4) of an array of type integer.
|
static <T extends java.lang.Comparable<? super T>> |
q3(T[] a)
Find the third quantile (p = 3/4) of an array of type double.
|
static double |
select(double[] arr,
int k)
Given k in [0, n-1], returns an array value from arr such that k array
values are less than or equal to the one returned.
|
static float |
select(float[] arr,
int k)
Given k in [0, n-1], returns an array value from arr such that k array
values are less than or equal to the one returned.
|
static int |
select(int[] arr,
int k)
Given k in [0, n-1], returns an array value from arr such that k array
values are less than or equal to the one returned.
|
static <T extends java.lang.Comparable<? super T>> |
select(T[] arr,
int k)
Given k in [0, n-1], returns an array value from arr such that k array
values are less than or equal to the one returned.
|
public static int select(int[] arr,
int k)
public static float select(float[] arr,
int k)
public static double select(double[] arr,
int k)
public static <T extends java.lang.Comparable<? super T>> T select(T[] arr,
int k)
public static int median(int[] a)
public static float median(float[] a)
public static double median(double[] a)
public static <T extends java.lang.Comparable<? super T>> T median(T[] a)
public static int q1(int[] a)
public static float q1(float[] a)
public static double q1(double[] a)
public static <T extends java.lang.Comparable<? super T>> T q1(T[] a)
public static int q3(int[] a)
public static float q3(float[] a)
public static double q3(double[] a)
public static <T extends java.lang.Comparable<? super T>> T q3(T[] a)