File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/main/java/com/thealgorithms/sorts Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 22
33/**
44 * Smooth Sort Algorithm Implementation
5- * Uses a heap-based approach similar to heap sort but with better cache performance
5+ * Uses heap-based approach for reliable sorting performance
66 *
77 * @see <a href="https://en.wikipedia.org/wiki/Smoothsort">Smooth Sort Algorithm</a>
88 */
@@ -21,12 +21,12 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
2121 private <T extends Comparable <T >> void heapSort (T [] array ) {
2222 int n = array .length ;
2323
24- // Build heap (rearrange array)
24+ // Build max heap
2525 for (int i = n / 2 - 1 ; i >= 0 ; i --) {
2626 heapify (array , n , i );
2727 }
2828
29- // Extract elements from heap one by one
29+ // Extract elements from heap
3030 for (int i = n - 1 ; i > 0 ; i --) {
3131 SortUtils .swap (array , 0 , i );
3232 heapify (array , i , 0 );
You can’t perform that action at this time.
0 commit comments