-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
68 lines (54 loc) · 1.02 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<stdio.h>
#include<stdlib.h>
#include"heapsort.h"
int main(){
heap H;
int flag;
printf("ENTER 1 FOR MAX AND 0 FOR MIN HEAP:");
scanf("%d",&flag);
if(flag != 1 && flag != 0){
printf("PLEASE ENTER VALID DATA!!\n");
return 0;
}
initH(&H, flag);
insertH(&H, 12);
//preorder(H);
//printf("\n");
insertH(&H, 1);
//preorder(H);
//printf("\n");
insertH(&H, 13);
//preorder(H);
//printf("\n");
insertH(&H, 121);
//preorder(H);
//printf("\n");
insertH(&H, 98);
//preorder(H);
//printf("\n");
insertH(&H, 17);
//preorder(H);
//printf("\n");
insertH(&H, 15);
//preorder(H);
//printf("\n");
insertH(&H, 45);
//preorder(H);
//printf("\n");
insertH(&H, 3);
//preorder(H);
//printf("\n");
insertH(&H, 23);
insertH(&H, 43);
insertH(&H, 563);
insertH(&H, 27);
preorder(H);
printf("\n");
printf("DELETED ELEMENT: %d\n",deleteH(&H));
preorder(H);
printf("\n");
heapSort(&H);
preorder(H);
printf("\n");
return 0;
}