Notes for topics covered at the review session: Note these topics were chosen by the students attending the session. The notes here are just an overview, but can be turned into good suggestions for practice problems if you want to study with your friends / try testing yourself on these topics before looking up some of the answers. ~~~B Trees~~~ * "sorted" trees just like AVL and BST * huge nodes with multiple (M - 1) keys as fenceposts for each branch node * nodes are huge (1 page / lookup size amount) to maximize efficiency for disk AKA far away memory / inefficient look-ups. * use last quarter's slides on B-Trees for the alorithm for put (slide 48/85), we went over an example of splitting nodes (nodes need to maintain the fixed # of L and M for every node to maintain the optimized memory look ups) ~~~QuickSort~~~ * strategies for picking a pivot (1st thing, median of 3) * run through the fact it can be done in place (advantage over mergesort) * ran through example of execution ~~~Sorts (Selection, Insertion, Merge, Quick, Heap)~~~ * drew out table of comparisons for best case runtime, worst case runtime (when best/worst occur and when to use and when to avoid), in place, and stable * reminder that main take aways for final: want to be able to use knowledge (not just reproduce mechanical procedures). Don't forget to note and consider: When do we use certain algorithms (in this case, the specific sorts)? ~~~Graph algorithms~~~ * BFS / DFS, overview of what they are / common uses basically graph traversals in general to visit all the nodes / find things. You can also use BFS to find the fewest edge path to notdes. Lots of applications to real world graph problems / set ups, try doing some graph algorithm questions with them) * Dijkstra's - ran through an example on made up graph * Topological sort - ran through example (from section #10) * reminder: probably is good to know what types of graphs you can run these algorithms on (Dijkstras = weighted graphs, topological on sorted graphs) and remember some common applications. ~~~Testing and Debugging~~~ Find as many bugs as you can with the following partial implementation of ArrayHeap (0-based indexing and 4 children min heap) public class ArrayHeap ... { private T[] heap; private int size; ... public void insert(T item) { this.heap[size] = item; size++; this.percolateUp(this.size - 1); } private void percolateUp(int index) { int parent = index - 1 / 4; while (this.heap[index] < this.heap[parent]) { this.heap[index] = this.heap[parent]; this.heap[parent] = this.heap[index]; index = parent; } } } Explain and draw some sample internal arrays and sample insert() calls. Describe where / when a bug will show itself and how that will affect the result. (You can ignore the major bugs like (SPOILERS ahead so only read if you've done the previous question) ... ... ... ... compareTo "bug", just assume it actually uses compareTo correctly) Get some practice writing unit test names. Try to write as many cases (and matching input + method call setups) as you can that would be helpful in testing the insert method, and debugging in general. ~~~ MSTs ~~~ * reviewed execution of Prim's and Kruskal's. Section 9 Problem 1. Be sure to review common applications / high level meaning of an MST / try to come up with a real-world graph representation where generating an MST would be useful. ~~~ Recurrences ~~~ * did Section 10 problem 1b together.