Midterm Review for CMPS 6610/4610, Fall 2016

Relevant Material:

  1. Analyzing Algorithms (Ch. 2.2)
  2. Asymptotic Notation (Ch. 3, A)
  3. Heaps and Binary Search Trees (Ch. 6, 12.1, 12.2, 13.2)
    • Binary search tree definition; BST property
    • Rotations
    • In-order tree traversal
    • Heap definition; max-heap property
    • Using array implementation, findMin takes O(1) time, and extractMin and decreaseKey take O(log n) time
    • Heapsort: Repeatedly extract min in min-heap; O(n log n) time
  4. Divide & Conquer (2.3, 4.3, 4.4, 4.5, 4.6)
    • You can call an algorithm divide-and-conquer only if the size of subproblems can be written as n/b where b>1
    • Mergesort, binary search, recursive squaring
    • Find the runtime recurrence for a recursive algorithm given in pseudocode
    • Solving Recurrences: Solve a runtime recurrence (i.e., find an upper bound for a recursively defined T(n)):
      • Recursion Tree: Find a guess what a (runtime) recurrence could solve to using recursion trees
        • Given T(n) = aT(n/b) + f(n)
        • a = #of subproblems = #of children at each node
        • n/b = subproblem size
        • Height of the tree = log_b (n) [log of n base b]
      • Big-Oh Induction
        • Prove your guess/claim using big-Oh induction (substitution method): Find conditions on constants c and n_0 in inductive step. (No need to handle base case.)
      • Master Theorem
        • Compute n^(log_b (a)) and compare with f(n)
        • Clearly write which case of the Master theorem applies, and give the values for ε, k, and c:
          • For case 1: Give the value of ε>0
          • For case 2: Give the value of k≥0
          • For case 3: Give the value of ε>0, check the regularity condition and give the value of c<1
        • Proof of the master theorem
  5. Quicksort and Order Statistics (5.2, C.3, 7, 9)
    • Randomized Algorithms
      • Probability and expectation
      • Expected runtime vs. average runtime, best-case runtime, and worst-case runtime
    • Quicksort
      • Deterministic quicksort:
        • Best-case runtime O(n log n) [When each pivot partitions the array into two roughly equal pieces]
        • Worst-case runtime: O(n^2) [When the array is already sorted either increasing or decreasing order]
      • Randomized quicksort: Expected runtime O(n log n)
    • Order Statistics
      • Select the i-th smallest element
      • Randomized selection: Worst-case runtime O(n^2), expected runtime O(n)
      • Deterministic selection: Select median of medians; worst-case runtime O(n)
  6. Dynamic Programming (Ch. 15.2-15.4):

Practice Problems from the Book:

  1. Analyzing algorithms:
    • page 22: 2.1-2, 2.1-3
    • page 39: 2.3-3,4,5,6,7
    • page 39: 2-1,4
  2. Asymptotic notation:
    • page 52: 3.1-1,2,3,4,5
    • page 61: 3-1,2,3,4
  3. Heaps and binary search trees:
    • page 153: all exercises
    • page 156: 6.2-3, 6.2-4
    • page 160: 6.4-3
    • page 167: 6-2
    • page 289: 12.1-1,2,3,4
    • page 314: 13.2-3
  4. Divide & conquer:
    • page 87: all exercises
    • page 92: all exercises
    • page 96: 4.5-1,2,3
    • page 107: 4-1,3
  5. Quicksort and order statistics:
    • page 1200: C.3-1,2,3,4
    • page 122: 5.2-3,4,5
    • page 143: 5-2
    • page 173: all exercises
    • page 178: 7.2-1,2,3
    • page 219: 9.2-3,4
  6. Dynamic programming:
    • page 389: 15.3-1,2,3,4
    • page 396: 15.4-1,2,3,4,5
    • page 406: 15-5