@@ -13,7 +13,7 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
1313 if (array == null || array .length <= 1 ) {
1414 return array ;
1515 }
16-
16+
1717 // For generic comparable types, use a simplified bucket sort approach
1818 bucketSort (array , 0 , array .length - 1 );
1919 return array ;
@@ -27,7 +27,7 @@ private <T extends Comparable<T>> void bucketSort(T[] array, int start, int end)
2727 // Find min and max values for partitioning
2828 T min = array [start ];
2929 T max = array [start ];
30-
30+
3131 for (int i = start + 1 ; i <= end ; i ++) {
3232 if (SortUtils .less (array [i ], min )) {
3333 min = array [i ];
@@ -52,11 +52,11 @@ private <T extends Comparable<T>> void bucketSort(T[] array, int start, int end)
5252
5353 // Partition into buckets based on comparison with pivot
5454 T pivot = array [start + length / 2 ];
55-
55+
5656 int lt = start ; // less than pivot
5757 int gt = end ; // greater than pivot
5858 int i = start ; // current element
59-
59+
6060 while (i <= gt ) {
6161 int cmp = array [i ].compareTo (pivot );
6262 if (cmp < 0 ) {
@@ -67,7 +67,7 @@ private <T extends Comparable<T>> void bucketSort(T[] array, int start, int end)
6767 i ++;
6868 }
6969 }
70-
70+
7171 // Recursively sort the partitions
7272 bucketSort (array , start , lt - 1 );
7373 bucketSort (array , gt + 1 , end );
@@ -77,7 +77,7 @@ private <T extends Comparable<T>> void insertionSort(T[] array, int start, int e
7777 for (int i = start + 1 ; i <= end ; i ++) {
7878 T key = array [i ];
7979 int j = i - 1 ;
80-
80+
8181 while (j >= start && SortUtils .greater (array [j ], key )) {
8282 array [j + 1 ] = array [j ];
8383 j --;
0 commit comments