Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 28 April 2005
What was this course about? How to solve computing problems. Problem analysis, to abstract away details and divide into smaller subproblems. Mathematical foundations for precise formulations of problems and solutions. Data structures and algorithms to solve problems correctly and efficiently. Java programming and modular software construction for good implementations.
Data Structures - Lists - Trees - Tries - Priority Queues - Hash Table Really not basic DS, more conceptual. - Graphs - Equiv. Relations - FSMs - Geometry - Polynomials
Algorithms - Searching - Hashing - Sorting - Compression - String Matching Complexity. Correctness. Applications. - Graph Algorithms - Dynamic Programming - Games - Polynomial Comp. - Comp. Geometry
Programming Object oriented programming. Correctness (loop invariants, induction). Time and space complexity. Debugging (test harness).
Studying for the Final Exam Review all material first Lectures, programs, quizzes Do sample finals – under time restrictions Old finals are in blackboard/assignments Types and difficulty of problems may be similar (some topics not covered)
Solving Recurrences, Asymptotics Solve T(n) = 3 T(n/3) + 1 Prove the correctness By induction Invariants Hold initially Preserved after each iteration of loop or method call Or other methods Big-Oh, little-oh, Big-Omega, Theta Master Theorem
Sorting and lower bounds
Insertion Sort Selection Sort Heapsort Mergesort Quicksort Radix Sort
Binary Trees 1.Traverse the tree inorder 2.Do exactly two rotations so that the tree is balanced 3. Consider a binary tree of height h a.What are the max and min number of nodes? b.What are the max and min number of leaves? 4. Perfect, full, complete trees
Balanced Binary Trees
Dictionaries
Hashing Describe why hashing a string to sum of its characters is not a good idea. Assume S = a 1 a 2 ….a n is a string Define H(S) = a i 2 i-1 (i=1..n) Describe a way to efficiently calculate H(S)
Priority Queues and Heaps Suppose you implement a priority queue using following Unsorted array Linked list (smallest at front) Heap What is the complexity in each case for deleteMin insert
Binary heaps
Compression
LZW compression
Data Compression Encode “I AM SAM SAM I AM SAM SAM” using Huffman compression LZW In each case calculate the compression ratio Is it possible to apply Huffman after applying LZW? If so apply Huffman to output generated by LZW above
Graphs What is breadth first traversal? What is depth first traversal? What data structures can be used to implement each one? Reachability Connected components Topological sort
Graphs
Adjacency lists and matrices Traversal (DFS, BFS) Reachability (DFS, BFS, Warshall) Shortest Paths (Dijkstra, Bellman- Ford) MST (Prim, Kruskal)
Greedy Algorithms Find the Shortest Path from Node 1 to every other node
Dynamic Programming Dependent subproblems, recursive solutions, memoizing, explicit tables. Knapsack Longest Common Subsequence Matrix Multiplication Floyd-Warshall-Kleene
Dynamic Programming Consider a sequence of n numbers, A = {a 1, a 2, a 3,..., a n }. A subsequence of a given sequence is just the given sequence with 0 or more of the elements removed. Let's find an algorithm that finds the subsequence, A' = {a i1, a i2, a i3,...a ik } of A that maximizes a i1 - a i2 + a i a ik (i.e. the sign alternates).
Game trees
Games 2-person, deterministic, complete information,... Backtracking MiniMax Alpha-beta pruning Heuristics, iterative deepening, move order, tricks,...
Union-find
String matching
Polynomials Horner’s method Lagrange interpolants secret sharing Karatsuba Alg Integer & polynomial multiplication FFT method for polynomial multiplication Schwartz: Is polynomial identically zero?
Computational Geometry
Points, lines, rays, line segments Intersection, turns Membership in region Convex hull Divide-and-Conquer (QuickHull,...) Lower Bound
Final Exam Thursday, May 5, 8:30 –11:30 am McConomy (*not* in WeH 7500) Sugary stuff will be provided... Make sure not to be late.
Final Exam Closed book, no calculators, cell phones, pagers, IM, … You can bring 1 (one) page of notes. Bring fluids
Conclusion Review all material Do all sample quizzes and finals Good luck!!