public int select ( int attIdx , int [ ] indices , int left , int right , int k ) { if ( left == right ) { return left ; } else { int middle = partition ( attIdx , indices , left , right ) ; if ( ( middle - left + 1 ) >= k ) { return select ( attIdx , indices , left , middle , k ) ; } else { return select ( attIdx , indices , middle + 1 , right , k - ( middle - left + 1 ) ) ; } } }
Implements computation of the kth - smallest element according to Manber s Introduction to Algorithms .