Final Exam Topics Topic Text Chapter -------------------- ------------- Algorithmic Pseudo-code........... 2 Rate of Growth of Functions and Asymptotic Notation........... 3 Divide-and-Conquer................ 4 The maximum-subarray problem.... 4.1 Strassen's matrix-mult algorithm 4.2 The substitution method......... 4.3 The recursion-tree method....... 4.4 The master method............... 4.5 Sorting Algorithms Insertion-sort.................. 2 Merge-sort...................... 2 Heap-sort....................... 6.1-6.4 Quicksort....................... 7 Quicksort and Partition....... 7.1 Quicksort performance......... 7.2 Randomized Quicksort.......... 7.3 Sorting in Linear Time.......... 8 Lower bounds for sorting...... 8.1 Counting sort................. 8.2 Radix sort.................... 8.3 Bucket sort................... 8.4 Dynamic sets Priority Queue Implementations Binary Heaps.................. 6.5 Insert Extract-Min Fibonacci Heaps............... 19 (after midterm) Structure of Fibonacci Heaps Unordered binomial trees The potential function The maximum degree Mergeable-heap operations Insert, Find Minimum, Union Extract-Min, Consolidate Decrease-Key, Delete Bounding the maximum degree Elementary Data Structures...... 10 Stacks and Queues............. 10.1 Linked Lists.................. 10.2 Implementing Pointers & Objs.. 10.3 Representing Rooted Trees..... 10.4 Hash Tables..................... 11 Direct-address tables......... 11.1 Hash Tables................... 11.2 Collision Resolution Chaining Open Addressing........... 11.4 Hash Functions (skip 11.3.3).. 11.3 Binary Search Trees............. 12.1-12.3 Tree-Walk Search Insert Delete Minimum Successor Red-Black Trees................. 13 Red-Black Properties.......... 13.1 Rotations..................... 13.2 Insertion (and Fixup)......... 13.3 Deletion (and Fixup).......... 13.4 --------- Material above was on midterm ------ B-Trees......................... 18 Definition.................... 18.1 Search........................ 18.2 Insert........................ 18.2 Split-Child Insert-Non-Full Delete........................ 18.3 Data Structures for Disjoint Sets 21 Disjoint Set Operations....... 21.1 Linked-List Representation.... 21.2 Disjoint Set Forests.......... 21.3 What heuristics can be used to speed performance of this data structure? ans: union by rank, and path compression Topic Text Chapter -------------------- ------------- Algorithm Analysis Dynamic Programming............. 15 What key ingredients are needed to solve a problem by dynamic programming? ans: optimal substructure + overlapping subproblems Rod-cutting problem........... 15.1 Matrix-chain Multiplication... 15.2 Elements of Dynamic Programming 15.3 Memoization (what is it?) Greedy Algorithms............... 16 What are two key ingredients are needed to solve a problem by a greedy algorithm? ans: greedy-choice property + optimal substructure Activity-selection Problem.... 16.1 Elements of Greedy Strategy... 16.2 Huffman Codes................. 16.3 Amortized Analysis.............. 17.1-17.3 Aggregate analysis The accounting method The potential method Graphs Implementations................. 22.1 Adjacency List Adjacency Matrix Graph Search Breadth-First................. 22.2 Depth-First................... 22.3 Topological Sort............ 22.4 Minimum Spanning Trees.......... 23 Generic-MST safe edges light edges MST-Kruskal MST-Prim Single-Source Shortest Paths.... 24.1-24.3 Bellman-Ford Algorithm DAG Algorithm Dijkstra's Algorithm All-Pairs Shortest Paths........ 25.1-25.2 Shortest paths and matrix multiplication The Floyd-Warshall Algorithm Possible Types of Exam Problems: (1) Writing Pseudocode (2) Runtime analysis of algorithms (3) You should be able to trace the algorithms and operations on the data structures that we have discussed. (4) Short answer (5) "Prove that ..." Especially questions from the Exercises and Problems in the Assignments. Materials allowed at exam: Two 4"x6" note cards (or equivalent) The following list contains examples of the kinds of questions listed above. The following is a list of Exercises and Problems from the text. Questions like these will appear on exams (in a slightly altered form). If they fall into one of the categories above, that is noted; the ones that have appeared in class assignments are marked with *'s. Page 14 Exercises: 1.2-2 (4) (but easier to calculate) 1.2-3 (4)* (but easier to calculate) Problems: 1-1 (first column) (4)* Pages 22-23 Exercises: 2.1-1 (3) 2.1-2 (1) 2.1-3 (1,5) Page 29 Exercises: 2.2-3 (2) Pages 37-39 Exercises: 2.3-2 (1)* 2.3-5 (2)* Page 53 Exercises: 3.1-4 (5)* 3.1-5 (5)* Page 60 Exercises: 3.2-3 (5)* 3.2-7 (5)* Page 60 Problems: 3-1 parts a., b., and c. (5)* Page 74 Exercises: 4.1-1 (4) Page 82 Exercises: 4.2-1 (3) Page 87 Exercises: 4.3-1 (5) Pages 92-93 Exercises: 4.4-1 (5) 4.4-2 (5) Pages 96-97 Exercises: 4.5-1 (4) 4.5-3 (5) Pages 153-154 Exercises: 6.1-1 (4) 6.1-2 (5)* 6.1-5 (4) 6.1-6 (4) Page 159 Exercises: 6.3-1 (3) 6.3-2 (4) 6.3-3 (5)* (too hard for exam) Pages 160,162 Exercises: 6.4-1 (3) Pages 164-166 Exercises: 6.5-1 (3) 6.5-2 (3) 6.5-3 (1)* (In Part 1, Assignment 4) Pages 173-174 Exercises: 7.1-1 (3) Page 178 Exercises: 7.2-1 (5) 7.2-2 (2) 7.2-3 (5) 7.2-4 (5) Pages 184-185 Exercises: 7.4-2 (2)* (too hard for exams) 7.4-4 (2)* (too hard for exams) Pages 193-194 Exercises: 8.1-1 (4) 8.1-2 (5) (in Ex. 3.2-3 above) Pages 199-200 Exercises: 8.3-1 (3) Page 204 Exercises: 8.4-1 (3) Pages 240-241 Exercises: 10.2-1 (4) 10.2-2 (5) 10.2-3 (5) Pages 248-249 Exercises: 10.4-4 (4) Page 261 Exercises: 11.2-2 (3) Page 277 Exercises: 11.4-1 (3) 11.4-2 (1) Page 289 Exercises: 12.1-1 (4) 12.1-2 (4) 12.1-4 (1) 12.1-5 (5)* Pages 293-294 Exercises: 12.2-1 (4) 12.2-2 (1)* 12.2-3 (1)* 12.2-5 (5)* Trace BST insertion/deletion (3) Pages 311-312 Exercises: 13.1-2 (3,4) 13.1-4 (4)* 13.1-5 (5)* 13.1-6 (4)* 13.1-7 (4) Pages 313-314 Exercises: 13.2-1 (1)* (In Assignment 8, Part 1) Page 322 Exercises: 13.3-1 (4) 13.3-2 (3) (trace RB-tree insertion)* 13.3-3 (4) Page 330 Exercises: 13.4-3 (3) (trace RB-tree deletion)* 13.4-5 (4) -------- material above was on midterm ------------ Pages 369-370 Exercises: 15.1-1 (5) 15.1-2 (4) 15.1-3 (1) 15.1-5 (1,4) Page 378 Exercises: 15.2-1 (3) (a bit too hard for an exam) 15.2-2 (1) 15.2-6 (5) Pages 389-390 Exercises: 15.3-2 (4) (but for 8 elements) 15.3-4 (4) (a bit too hard for an exam) Pages 421-422 Exercises: 16.1-1 (1,2) (too hard for an exam) Pages 427-428 Exercises: 16.2-1 (5) (too hard for an exam) 16.2-2 (1,2) (too hard for an exam) Pages 436-437 Exercises: 16.3-1 (5) (too hard for an exam) 16.3-2 (5) (too hard for an exam) 16.3-3 (3,4) (i.e. trace Huffman) Page 456 Exercises: 17.1-1 (4) 17.1-2 (4) 17.1-3 (4) * (Assignment 10) Page 459 Exercises: 17.2-2 (4) * (Assignment 10) Pages 462-463 Exercises: 17.3-1 (5) 17.3-2 (4) * (Assignment 10) 17.3-2 (5) (too hard for an exam) Pages 490-491 Exercises: 18.1-1 (4) 18.1-2 (4) 18.1-4 (5) 18.1-5 (4) * (Assignment 8) Pages 497-499 Exercises: 18.2-1 (3) (Trace B-tree insertion/deletion) 18.2-3 (1) 18.2-6 (5) (too hard for an exam) Page 502 Exercises: 18.3-1 (3) (Trace B-tree insertion/deletion) 18.3-2 (1)* (Assignment 9, I won't ask it on the final) Page 518 19.2-1 (3) Page 522 19.3-1 (5) (too hard for an exam) Page 522 19.4-1 (5) (too hard for an exam) 19.4-2 (5) (interesting, but way too hard for an exam) Page 564 Exercises: (will not be on final) 21.1-1 (3) (too long for an exam) 21.1-3 (2) Pages 567-568 Exercises: (will not be on final) 21.2-1 (1) (a bit too long for an exam) 21.2-2 (3) (a bit too long for an exam) 21.2-4 (2) Page 572 Exercises: (will not be on final) (but know the speed-up heuristics above) 21.3-1 (3) (too long for an exam) 21.3-2 (1) Pages 592-593 Exercises: 22.1-1 (4) 22.1-2 (4) 22.1-5 (1,2) Pages 601-602 Exercises: 22.2-1 (3) 22.2-2 (3) 22.2-3 (2) Pages 610-612 Exercises: 22.3-2 (3) 22.3-3 (3) 22.3-5 (5) (a bit hard for an exam) 22.3-7 (1) Pages 614-615 Exercises: 22.4-1 (3) (won't ask this one) Chapter 23: Be able to trace Prim's and Kruskal's algorithms (3) Pages 654-655 Exercises: 24.1-1 (3) Pages 662-664 Exercises: 24.3-1 (3)* 24.3-3 (4) Pages 691-693 Exercises: 25.1-6 (1) (too hard for an exam) 25.1-7 (1) (too hard for an exam) Pages 699-700 Exercises: 25.2-1 (3)* (like Part II of Assignment 14) 25.2-4 (5) (Useful, but won't ask it)