package quicksort;

import java.util.Arrays;

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

public class sortingtech {

public static void main(String args) {

//enter some numbers in unsorted manner.
//i have entered 10 numbers

int UnsortedNumbers = {10,50,40,6,66,99,33,6,7,267};

//i used System.out.println
//it is a Java statement that prints the argument passed
System.out.println(“Numbers Before using Quick Sorting -: ” + Arrays.toString(UnsortedNumbers));

// set the int low equal to 0

int low = 0;

int high = UnsortedNumbers.length – 1;

quickSort(UnsortedNumbers, low, high);

//for printing the numbers after quick sort

System.out.println(“Numbers After using Quick Sorting -: ” + Arrays.toString(UnsortedNumbers));
}

//creation of public method quickSort
//i created this method “Public” so that i can call it anywhere in my code.

public static void quickSort(int arr, int l, int h) {

//by quick sort algorithm

if (arr == null || arr.length == 0)

return;

if (l >= h)

return;

//now pick up the pivot point

int m = l + (h – l);

int point = arrm;

// make left point

int x = l, y = h;

//using while loop

while (x point) {
y–;
}

if (x x)
quickSort(arr, x, h);

}
}