Professional Documents
Culture Documents
Binary Search Trees vs. Binary Heaps
Binary Search Trees vs. Binary Heaps
Binary Heaps
10
11
12
13
14
15
50
24
78
12
36
64
90
15
29
44
58
67
81
93
50
24
78
12
3
36
15
29
64
44
58
90
67
81
93
10
11
12
13
14
15
50
24
78
12
36
64
90
15
29
44
58
67
81
93
50
24
78
12
3
36
15
29
64
44
58
90
67
81
93
bool Find(int x) {
return Find_rec(x, 1);
}
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
10
11
12
13
14
15
-1
10
16
33
48
49
24
81
63
78
58
67
-1
-1
3
10
16
24
33
81
63
48
78
58
49
67
log(N)*M
Push: O(log N)
Find Min: O(log N)
Remove Min: O(log N)
Push: O(1)
Find Min: O(1)
Remove Min: O(log N)
Pushing N = 10,000,000
230 million operations
Removing M minimums
M = 1,000,000
20 million operations
Pushing N = 10,000,000
10 million operations
Removing M minimums
M = 1,000,000
20 million operations