change pivot in my quickSort algorithm java
I have implemented a working quickSort algorithm using the first element in the array as the pivot, that look like this: public int[] quickSort( int[] a, int start, int end){ int l = start; int r = end; int pivotIndex = start; //<---- first element in the array as pivot! // must be at least two elements if ( end - start >= 1){ // set pivot int pivot = a[pivotIndex]; while ( r > l ){ // scan from the left while ( a[l] <= pivot && l <= end && r > l ){ l++; } while ( a[r] > pivot && r >= start && r >= l){ r--; } if ( r > l ){ this.swap(a, l, r); } } this.swap(a, pivotIndex, r); System.out.println