kthsmallest
Class ArrayUtils

java.lang.Object
  extended by kthsmallest.ArrayUtils

public class ArrayUtils
extends java.lang.Object

This class provides static methods (utilities) for manipulating arrays.


Constructor Summary
ArrayUtils()
           
 
Method Summary
static int kSmall(int k, int[] anArray, int first, int last)
          Returns the kth-smallest element of the given array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

kSmall

public static int kSmall(int k,
                         int[] anArray,
                         int first,
                         int last)
Returns the kth-smallest element of the given array.

Effects: Upon return, the given array is partitioned around the kth element: elements to the left are smaller than, and elements to the right are larger than, the kths element, whose index will be k-1.

Parameters:
k - indicates position of desired element
anArray - array of elements to be searched
first - first element of anArray to begin searching
last - last element of anArray to search