MCPcopy Create free account
hub / github.com/careercup/ctci / quickSort

Method quickSort

java/Chapter 11/Introduction/Quicksort.java:36–44  ·  view source on GitHub ↗
(int arr[], int left, int right)

Source from the content-addressed store, hash-verified

34 }
35
36 public static void quickSort(int arr[], int left, int right) {
37 int index = partition(arr, left, right);
38 if (left < index - 1) { // Sort left half
39 quickSort(arr, left, index - 1);
40 }
41 if (index < right) { // Sort right half
42 quickSort(arr, index, right);
43 }
44 }
45
46 public static void main(String[] args) {
47 int[] arr = AssortedMethods.randomArray(20, 0, 20);

Callers 1

mainMethod · 0.95

Calls 1

partitionMethod · 0.95

Tested by

no test coverage detected