1
COMP 250
Lecture 25
heaps 3
- Nov. 6, 2017
heaps 3 Nov. 6, 2017 1 STEM Support https://infomcgillste - - PowerPoint PPT Presentation
COMP 250 Lecture 25 heaps 3 Nov. 6, 2017 1 STEM Support https://infomcgillste m.wixsite.com/stems upportmcgill MSSG = McGill Space systems group http://www.mcgillspace.com/#!/ 2 RECALL: min Heap (definition) a b e u f l k m
1
2
STEM Support https://infomcgillste m.wixsite.com/stems upportmcgill
MSSG = McGill Space systems group http://www.mcgillspace.com/#!/
3
4
1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Not used
5
6
7
0 1000 2000 3000 4000 5000 12 8 4
1 2 π πππ2π β€ π’ π
9
10
11
1
2 3 4 5 6
12
1
2 3 4 5 6
13
1
2 3 4 5 6
14
1
2 3 4 5 6
15
1
2 3 4 5 6
16
1
2 3 4 5 6
17
1
2 3 4 5 6
18
1
2 3 4 5 6
19
20
21
22
23
1/8 of the nodes do at most two swapsβ¦.
24
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15
25
26
27
28
29
30
Second term index goes to h-1 only
31
32