Initialize pairing heap randomly
This commit is contained in:
parent
ac9353cef3
commit
c032a92fa4
@ -13,9 +13,9 @@ steps:
|
|||||||
image: python
|
image: python
|
||||||
commands:
|
commands:
|
||||||
- python3 -c "print(6 * 7)"
|
- python3 -c "print(6 * 7)"
|
||||||
- name: gcc
|
- name: algo2
|
||||||
image: gcc
|
image: gcc
|
||||||
commands:
|
commands:
|
||||||
- cd pairingheap
|
- cd algo2
|
||||||
- gcc -o pairingheap pairingheap.c
|
- gcc -o pairingheap pairingheap.c
|
||||||
- ./pairingheap
|
- ./pairingheap
|
||||||
|
@ -161,14 +161,14 @@ struct PHeapNode *ph_deletemin(struct PHeap *ph) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
srand(2309);
|
||||||
|
|
||||||
struct PHeap ph;
|
struct PHeap ph;
|
||||||
ph_init(&ph);
|
ph_init(&ph);
|
||||||
|
|
||||||
ph_insert_malloc(&ph, 42);
|
for (int i = 0; i < 20; i++) {
|
||||||
ph_insert_malloc(&ph, 10);
|
ph_insert_malloc(&ph, rand() % 100);
|
||||||
ph_insert_malloc(&ph, 0);
|
}
|
||||||
ph_insert_malloc(&ph, 100);
|
|
||||||
ph_insert_malloc(&ph, 12);
|
|
||||||
|
|
||||||
ph_print(&ph);
|
ph_print(&ph);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user