public static double kthSmallestValue ( int [ ] array , int k ) { int [ ] index = new int [ array . length ] ; for ( int i = 0 ; i < index . length ; i ++ ) { index [ i ] = i ; } return array [ index [ select ( array , index , 0 , array . length - 1 , k ) ] ] ; }
Returns the kth - smallest value in the array .