You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
538 B
C
27 lines
538 B
C
3 years ago
|
#include <stdio.h>
|
||
|
#include "pqueue.c"
|
||
|
|
||
|
int main() {
|
||
|
int n;
|
||
|
scanf("%d", &n);
|
||
|
binary_heap *bh = binary_heap_new(n);
|
||
|
binary_heap_insert(bh, (bhnode) {10, 2});
|
||
|
binary_heap_insert(bh, (bhnode) {113, 34});
|
||
|
binary_heap_insert(bh, (bhnode) {1, 56});
|
||
|
binary_heap_insert(bh, (bhnode) {4, 6745});
|
||
|
binary_heap_insert(bh, (bhnode) {5, 321});
|
||
|
binary_heap_insert(bh, (bhnode) {6, 346});
|
||
|
print_heap(bh);
|
||
|
|
||
|
binary_heap_erase(bh);
|
||
|
print_heap(bh);
|
||
|
|
||
|
binary_heap_erase(bh);
|
||
|
binary_heap_erase(bh);
|
||
|
|
||
|
print_heap(bh);
|
||
|
|
||
|
binary_heap_destroy(bh);
|
||
|
|
||
|
}
|