11package com .thealgorithms .sorts ;
2+
23/**
34 * QuickSort is a divide-and-conquer sorting algorithm.
45 *
@@ -40,7 +41,7 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
4041 * The sorting process
4142 *
4243 * @param array The array to be sorted
43- * @param left The first index of an array
44+ * @param left The first index of an array
4445 * @param right The last index of an array
4546 */
4647 private static <T extends Comparable <T >> void doSort (T [] array , final int left , final int right ) {
@@ -59,13 +60,13 @@ private static <T extends Comparable<T>> void doSort(T[] array, final int left,
5960 * Randomizes the array to avoid already ordered or nearly ordered sequences
6061 *
6162 * @param array The array to be sorted
62- * @param left The first index of an array
63+ * @param left The first index of an array
6364 * @param right The last index of an array
6465 * @return the partition index of the array
6566 */
6667 private static <T extends Comparable <T >> int randomPartition (T [] array , final int left , final int right ) {
67- // Randomizing the pivot helps avoid worst-case performance
68- // for already sorted or nearly sorted arrays
68+ // Randomizing the pivot helps avoid worst-case performance
69+ // for already sorted or nearly sorted arrays
6970 final int randomIndex = left + (int ) (Math .random () * (right - left + 1 ));
7071 SortUtils .swap (array , randomIndex , right );
7172 return partition (array , left , right );
@@ -75,13 +76,12 @@ private static <T extends Comparable<T>> int randomPartition(T[] array, final in
7576 * This method finds the partition index for an array
7677 *
7778 * @param array The array to be sorted
78- * @param left The first index of an array
79+ * @param left The first index of an array
7980 * @param right The last index of an array
80- * array
8181 */
8282 private static <T extends Comparable <T >> int partition (T [] array , int left , int right ) {
8383 final int mid = (left + right ) >>> 1 ;
84- // Choose the middle element as the pivot
84+ // Choose the middle element as the pivot
8585 final T pivot = array [mid ];
8686 // Move the left and right pointers towards each other
8787 while (left <= right ) {
0 commit comments