5
5
6
6
### what is it
7
7
8
- A binary search tree is a tree data structure where:
8
+ a binary tree where the smallest value is always on the top. used to implement a *** priority queue ** or ** heap sort **
9
9
10
- - The nodes to the left are smaller than the current node.
11
- - The nodes to the right are larger than the current node.
12
10
### costs
13
11
14
12
<table border =" 2 " cellspacing =" 0 " cellpadding =" 6 " rules =" groups " frame =" hsides " >
@@ -23,45 +21,45 @@ A binary search tree is a tree data structure where:
23
21
</colgroup >
24
22
<thead >
25
23
<tr >
26
- <th scope =" col " class =" org-left " >BST</th >
27
- <th scope =" col " class =" org-left " >avarage</th >
24
+ <th scope =" col " class =" org-left " >Heap</th >
28
25
<th scope =" col " class =" org-left " >worst</th >
29
26
</tr >
30
27
</thead >
31
28
32
29
<tbody >
33
30
<tr >
34
- <td class =" org-left " >Access</td >
35
- <td class =" org-left " >O(log(n))</td >
36
- <td class =" org-left " >O(n)</td >
31
+ <td class =" org-left " >Get Min</td >
32
+ <td class =" org-left " >O(1)</td >
37
33
</tr >
38
34
39
35
40
36
<tr >
41
- <td class =" org-left " >Search </td >
37
+ <td class =" org-left " >Remove Min </td >
42
38
<td class =" org-left " >O(log(n))</td >
43
- <td class =" org-left " >O(n)</td >
44
39
</tr >
45
40
46
41
47
42
<tr >
48
43
<td class =" org-left " >Insertion</td >
49
44
<td class =" org-left " >O(log(n))</td >
50
- <td class =" org-left " >O(n)</td >
51
45
</tr >
52
46
53
47
54
48
<tr >
55
- <td class =" org-left " >Deletion</td >
56
- <td class =" org-left " >O(log(n))</td >
49
+ <td class =" org-left " >Heapsort</td >
50
+ <td class =" org-left " >O(n*log(n))</td >
51
+ </tr >
52
+
53
+
54
+ <tr >
55
+ <td class =" org-left " >Heapify</td >
57
56
<td class =" org-left " >O(n)</td >
58
57
</tr >
59
58
</tbody >
60
59
61
60
<tbody >
62
61
<tr >
63
62
<td class =" org-left " >Space</td >
64
- <td class =" org-left " >  ; </td >
65
63
<td class =" org-left " >O(n)</td >
66
64
</tr >
67
65
</tbody >
0 commit comments