aboutsummaryrefslogtreecommitdiff
path: root/heap.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-11-29 15:53:19 +0100
committerThomas Schmucker <ts@its1.de>2020-11-29 15:53:19 +0100
commit6af11155551496fa173f96759f0f36774a0fb503 (patch)
treef569b2b74d61a751d307cb22170a8901b4b26705 /heap.c
parent15520a016648363160accfb409b159fa69390709 (diff)
downloaddata-structures-6af11155551496fa173f96759f0f36774a0fb503.tar.gz
data-structures-6af11155551496fa173f96759f0f36774a0fb503.tar.bz2
data-structures-6af11155551496fa173f96759f0f36774a0fb503.zip
altes Testprogramm aktiviert...
Diffstat (limited to 'heap.c')
-rw-r--r--heap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/heap.c b/heap.c
index e2ca750..6ad3010 100644
--- a/heap.c
+++ b/heap.c
@@ -122,6 +122,8 @@ my_heapsort(T a[], size_t n)
122 } 122 }
123} 123}
124 124
125// TODO: https://www.geeksforgeeks.org/how-to-check-if-a-given-array-represents-a-binary-heap/
126
125// ------------------------------------------- 127// -------------------------------------------
126 128
127struct pq { // Priority Queue 129struct pq { // Priority Queue
@@ -230,13 +232,16 @@ main(void)
230{ 232{
231 test_heapsort(); 233 test_heapsort();
232 test_pq(); 234 test_pq();
233#if 0 // Heap-Testprogramm 235#if 1 // Heap-Testprogramm
236 // Beispiel aus "Informatik - Datenstrukturen und Konzepte der Abstraktion"
237 // Kapitel 5.10, Seite 372 ff.
234 T heap[20] = { 18, 18, 16, 9, 7, 1, 9, 3, 7, 5 }; 238 T heap[20] = { 18, 18, 16, 9, 7, 1, 9, 3, 7, 5 };
235 239
236 print_heap(heap, 10); 240 print_heap(heap, 10);
237 241
238 //heap[10] = 13; fixup(heap, 10); 242 //heap[10] = 13; fixup(heap, 10);
239 swap(heap, 0, 9); fixdown(heap, 0, 9); 243 swap(heap, 0, 9);
244 fixdown(heap, 0, 9);
240 245
241 print_heap(heap, 9); 246 print_heap(heap, 9);
242#endif 247#endif