Question: @Test public void testQuickSort ( ) { int [ ] arr = { 8 , 9 , 1 , 3 , 2 , 6 }

@Test
public void testQuickSort(){
int[] arr ={8,9,1,3,2,6};
int comparisons = SortingAlgorithm.quicksort(arr,0, arr.length -1);
assertArrayEquals(new int[]{1,2,3,6,8,9}, arr);
assertEquals(7, comparisons);
}
// Quick Sort
private static int partition(int[] numbers, int startIndex, int endIndex){
int comparisons =0;
// TODO: Implement Partition function here
return comparisons;
}
public static int quicksort(int[] numbers, int startIndex, int endIndex){
int comparisons =0;
// TODO: Implement Quick Sort algorithm here
return comparisons;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!