aboutsummaryrefslogtreecommitdiff
path: root/heap.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-11-29 12:01:40 +0100
committerThomas Schmucker <ts@its1.de>2020-11-29 12:01:40 +0100
commit15520a016648363160accfb409b159fa69390709 (patch)
tree9054b9b2fde8a2ac3165511f389fd1359d98f860 /heap.c
parentd8fa41d3f56640dcf3b59b9555d9a74d88fd48ca (diff)
downloaddata-structures-15520a016648363160accfb409b159fa69390709.tar.gz
data-structures-15520a016648363160accfb409b159fa69390709.tar.bz2
data-structures-15520a016648363160accfb409b159fa69390709.zip
vereinfache die Schleife in heapsort()
Diffstat (limited to 'heap.c')
-rw-r--r--heap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/heap.c b/heap.c
index 3e354c4..e2ca750 100644
--- a/heap.c
+++ b/heap.c
@@ -116,9 +116,9 @@ my_heapsort(T a[], size_t n)
116{ 116{
117 heapify(a, n); 117 heapify(a, n);
118 118
119 for ( size_t i = n; i-- > 0; ) { 119 while ( n-- ) {
120 swap(a, 0, i); 120 swap(a, 0, n);
121 fixdown(a, 0, i); 121 fixdown(a, 0, n);
122 } 122 }
123} 123}
124 124