In java, check if the quicksort algorithm is correctlyimplemented. If not, edit the code to fix it.
public class KthSmallest {
private static void swap(int[] theArray, int i, intj){
int temp = theArray[i];
theArray[i] = theArray[j];
theArray[j] = temp;
}
private static int partition(int[] theArray, int first, intlast){
// Returns the index of the pivot element after partitioning
// theArray[first..last]
int p = theArray[first]; // use the first item of the array asthe pivot (p)
int lastS1 = first; // set S1 and S2 to empty
// ToDo: Determine the regions S1 and S2
// Refer to the quicksort algorithm
while (first <= last) {
//searching number which is greater than pivot,bottom up
PayPal Gateway not configured
PayPal Gateway not configured