The.Algorithm.Design.Manual.Springer-Verlag.1998
The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998
Binary Search Trees From an algorithm design viewpoint, it is most important to know that these trees exist and that they can be used as black boxes to provide an efficient dictionary implementation. When figuring the costs of dictionary operations for algorithm analysis, assume the worst-case complexities of balanced binary trees to be a fair measure. Next: Priority Queues Up: Fundamental Data Types Previous: Dictionaries Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK/NODE26.HTM (3 of 3) [19/1/2003 1:28:24]
Priority Queues Next: Specialized Data Structures Up: Fundamental Data Types Previous: Binary Search Trees Priority Queues Many algorithms process items according to a particular order. For example, suppose you have to schedule a list of jobs given the deadline by which each job must be performed or else its importance relative to the other jobs. Scheduling jobs requires sorting them by time or importance, and then performing them in this sorted order. Priority queues provide extra flexibility over sorting, which is required because jobs often enter the system at arbitrary intervals. It is much more cost-effective to insert a new job into a priority queue than to re-sort everything. Also, the need to perform certain jobs may vanish before they are executed, meaning that they must be removed from the queue. The basic priority queue supports three primary operations: ● Insert(Q,x): Given an item x with key k, insert it into the priority queue Q. ● Find-Minimum(Q) or Find-Maximum(Q): Return a pointer to the item whose key value is smaller (larger) than any other key in the priority queue Q. ● Delete-Minimum(Q) or Delete-Maximum(Q) - Remove the item from the priority queue Q whose key is minimum (maximum). Figure: The maximum and minimum element in a binary search tree All three of these priority queue operations can be implemented in time by representing the heap with a binary search tree. Implementing the find-minimum operation requires knowing where the minimum element in the tree is. By definition, the smallest key must reside in the left subtree of the root, since all keys in the left subtree have values less than that of the root. Therefore, as shown in Figure , the minimum element must be the leftmost decendent of the root. Similarly, the maximum element must be the rightmost decendent of the root. Find-Maximum(x) Find-Minimum(x) while do x = left[x] return x while return x file:///E|/BOOK/BOOK/NODE27.HTM (1 of 2) [19/1/2003 1:28:25] do x = right[x]
- Page 91 and 92: References Rei72 Rei91 Rei94 E. Rei
- Page 93 and 94: References Prentice Hall, Englewood
- Page 95 and 96: References SR95 SS71 SS90 SSS74 ST8
- Page 97 and 98: References Tin90 Mikkel Thorup. On
- Page 99 and 100: References Wel84 T. Welch. A techni
- Page 101 and 102: References Algorithms Mon Jun 2 23:
- Page 103 and 104: Correctness and Efficiency Next: Co
- Page 105 and 106: Correctness NearestNeighborTSP(P) P
- Page 107 and 108: Correctness Figure: A bad example f
- Page 109 and 110: Efficiency Next: Expressing Algorit
- Page 111 and 112: Keeping Score Next: The RAM Model o
- Page 113 and 114: The RAM Model of Computation substa
- Page 115 and 116: Best, Worst, and Average-Case Compl
- Page 117 and 118: The Big Oh Notation Figure: Illustr
- Page 119 and 120: Logarithms Next: Modeling the Probl
- Page 121 and 122: Logarithms justified in ignoring th
- Page 123 and 124: Modeling the Problem Figure: Modeli
- Page 125 and 126: About the War Stories Next: War Sto
- Page 127 and 128: War Story: Psychic Modeling Next: E
- Page 129 and 130: War Story: Psychic Modeling have pu
- Page 131 and 132: War Story: Psychic Modeling Next: E
- Page 133 and 134: Exercises (b) If I prove that an al
- Page 135 and 136: Fundamental Data Types Next: Contai
- Page 137 and 138: Containers Next: Dictionaries Up: F
- Page 139 and 140: Dictionaries Next: Binary Search Tr
- Page 141: Binary Search Trees BinaryTreeQuery
- Page 145 and 146: Specialized Data Structures Next: S
- Page 147 and 148: Sorting Next: Applications of Sorti
- Page 149 and 150: Applications of Sorting Figure: Con
- Page 151 and 152: Data Structures Next: Incremental I
- Page 153 and 154: Incremental Insertion Next: Divide
- Page 155 and 156: Randomization Next: Bucketing Techn
- Page 157 and 158: Randomization Next: Bucketing Techn
- Page 159 and 160: Bucketing Techniques Algorithms Mon
- Page 161 and 162: War Story: Stripping Triangulations
- Page 163 and 164: War Story: Stripping Triangulations
- Page 165 and 166: War Story: Mystery of the Pyramids
- Page 167 and 168: War Story: Mystery of the Pyramids
- Page 169 and 170: War Story: String 'em Up We were co
- Page 171 and 172: War Story: String 'em Up Figure: Su
- Page 173 and 174: Exercises Next: Implementation Chal
- Page 175 and 176: Exercises used to select the pivot.
- Page 177 and 178: Dynamic Programming Next: Fibonacci
- Page 179 and 180: Fibonacci numbers Next: The Partiti
- Page 181 and 182: Fibonacci numbers Next: The Partiti
- Page 183 and 184: The Partition Problem . What is the
- Page 185 and 186: The Partition Problem Figure: Dynam
- Page 187 and 188: Approximate String Matching Next: L
- Page 189 and 190: Approximate String Matching The val
- Page 191 and 192: Longest Increasing Sequence Will th
Binary Search Trees<br />
From an algorithm design viewpoint, it is most important to know that these trees exist and that they can<br />
be used as black boxes to provide an efficient dictionary implementation. When figuring the costs of<br />
dictionary operations for algorithm analysis, assume the worst-case complexities of balanced binary trees<br />
to be a fair measure.<br />
Next: Priority Queues Up: Fundamental Data Types Previous: Dictionaries<br />
<strong>Algorithm</strong>s<br />
Mon Jun 2 23:33:50 EDT 1997<br />
file:///E|/BOOK/BOOK/NODE26.HTM (3 of 3) [19/1/2003 1:28:24]