From 15520a016648363160accfb409b159fa69390709 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sun, 29 Nov 2020 12:01:40 +0100 Subject: vereinfache die Schleife in heapsort() --- heap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'heap.c') 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) { heapify(a, n); - for ( size_t i = n; i-- > 0; ) { - swap(a, 0, i); - fixdown(a, 0, i); + while ( n-- ) { + swap(a, 0, n); + fixdown(a, 0, n); } } -- cgit v1.3