ca.pfv.spmf.algorithms.sort
Class Select
- java.lang.Object
-
- ca.pfv.spmf.algorithms.sort.Select
-
public class Select extends java.lang.ObjectImplementation of a few selection algorithms (randomized select, etc.). based on description from the book "Introduction to Algorithms" from MIT Press. Please refer to that book for details about the algorithms and proofs that they are correct.
-
-
Constructor Summary
Constructors Constructor and Description Select()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static intrandomizedSelect(int[] a, int i)Method to select the ith smallest integer of an array in average linear time.
-
-
-
Method Detail
-
randomizedSelect
public static int randomizedSelect(int[] a, int i)Method to select the ith smallest integer of an array in average linear time. Based on the Randomized-Select algorithm in "Introduction to algorithms" book by Cormen et al. (2001).- Parameters:
a- array of integersi- the i value- Returns:
- the element of "a" that is larger than i elements.
-
-
DMelt 3.0 © DataMelt by jWork.ORG