-
Notifications
You must be signed in to change notification settings - Fork 0
/
heap_example.txt
98 lines (85 loc) · 1.25 KB
/
heap_example.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
==========
NO = FALSE
YES = TRUE
==========
========================1st Example======================
FOLLOWING IS A TREE
12
11 10
9 8 7 6
5 0
n = 9
num = 11
parent = 12
i = 1
array[1] = 0 > 12
12
0 10
9 8 7 6
5
n = 8
left = 3
right = 4
4 < 8? YES
0 >= 9 && 0 >= 8? NO
9 <= 8? YES
12
9 10
0 8 7 6
5
n = 8
i = 3
left = 7
right = 8
8 < 8? NO
7 == 8 - 1? Yes && 0?
temp = 0
array[3] = 5
array[7] = 0
12
9 10
5 8 7 6
0
========================NEXT EXAMPLE===================
12
11 10
9 8 7 6
5 1 0
n = 10
num = 11
parent = 12
i = 1
array[1] = 0 > 12
12
0 10
9 8 7 6
5 1
n = 9
left = 3
right = 4
4 < 9? YES
0 >= 9 && 0 >= 8? NO
9 <= 8? YES
12
9 10
0 8 7 6
5 1
n = 9
i = 3
left = 7
right = 8
8 < 9? YES
(0 >= 5? NO && 0 >= 1? NO) NO
1 <= 5? YES
temp = 0
array[3] = 5
array[7] = 0
i = 7
left = 15
right = 16
16 < 9? NO
(15 == 9 - 1? NO && 0? NO) NO
12
9 10
5 8 7 6
0 1