Académique Documents
Professionnel Documents
Culture Documents
Binary Heaps
All of is left children and grand-children are less than i.value All of is right children and grand-children are greater than i.value
50
24
78
12
36 50
64
90
15
29
44
58
67
81
93
24 12 3 15 29 36 44 58 64 67
78 90 81 93
10
11
12
13
14
15
50
24
78
12
36 50
64
90
15
29
44
58
67
81
93
24 12 3 15 29 36 44 58 64 67
78 90 81 93
10
11
12
13
14
15
-1
50
24
78
12
36
64
90
15
29
44
-1
-1
-1
Tons of applications:
OS process queues, Transaction Processing, Packet routing in advanced networks, used in various other algoriothms
N*M
N all the packets 10 million M 1 million top priority packets Must be processed in one minute. Assume your computer can do 10 billion operation per second 600 billion operation in one minute. Unfortunately, N*M is 10 trillion operations.
All of is left children and grand-children are greater than i.value All of is right children and grand-children are greater than i.value
-1
10
16
33 3
48
49
24
81
63
78
58
67
-1
-1
10 16 24 81 63 33 78 58 48 67
5 49
log(N)*M
N all the packets 10 million M 1 million top priority packets Must be processed in one minute. Assume your computer can do 1 billion operation per second 60 billion operation in one minute. What is log(N)*M?