From c032a92fa450e85d30d635947e046b36649e226e Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 13 Sep 2022 17:53:16 +0200 Subject: [PATCH] Initialize pairing heap randomly --- .drone.yml | 4 ++-- algo2/pairingheap.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index c43890d..c114bb7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,9 +13,9 @@ steps: image: python commands: - python3 -c "print(6 * 7)" - - name: gcc + - name: algo2 image: gcc commands: - - cd pairingheap + - cd algo2 - gcc -o pairingheap pairingheap.c - ./pairingheap diff --git a/algo2/pairingheap.c b/algo2/pairingheap.c index e2624a5..4e0e8d0 100644 --- a/algo2/pairingheap.c +++ b/algo2/pairingheap.c @@ -161,14 +161,14 @@ struct PHeapNode *ph_deletemin(struct PHeap *ph) { } int main() { + srand(2309); + struct PHeap ph; ph_init(&ph); - ph_insert_malloc(&ph, 42); - ph_insert_malloc(&ph, 10); - ph_insert_malloc(&ph, 0); - ph_insert_malloc(&ph, 100); - ph_insert_malloc(&ph, 12); + for (int i = 0; i < 20; i++) { + ph_insert_malloc(&ph, rand() % 100); + } ph_print(&ph);