We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04c04bf commit a848a87Copy full SHA for a848a87
1 file changed
src/main/java/com/thealgorithms/sorts/SmoothSort.java
@@ -13,19 +13,19 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
13
if (array == null || array.length <= 1) {
14
return array;
15
}
16
-
+
17
heapSort(array);
18
19
20
21
private <T extends Comparable<T>> void heapSort(T[] array) {
22
int n = array.length;
23
24
// Build max heap
25
for (int i = n / 2 - 1; i >= 0; i--) {
26
heapify(array, n, i);
27
28
29
// Extract elements from heap
30
for (int i = n - 1; i > 0; i--) {
31
SortUtils.swap(array, 0, i);
0 commit comments