CS 411 Fall 2025  >  Midterm Exam Review Problems


CS 411 Fall 2025
Midterm Exam Review Problems

Below are some problems you may wish to work through in preparation for the Midterm Exam. These are not to be turned in. Answers are not available here; however, I would be happy to discuss any of these.

Additional problems may be added to this document.

  1. What two important properties does an algorithm have, which distinguishes it from instructions that one person might give to another, or from a computer program?
  2. What do we mean when we say an algorithm is efficient (in the more general sense of the word)?
  3. What, in the context of this class, is a graph?
  4. Describe adjacency matrices and adjacency lists. How do these differ?
  5. What is time complexity?
  6. How do we measure the running time of an algorithm? (The most important operation is called—what?)
  7. What is amortized efficiency?
  8. Give a reasonable basic operation for each of the following algorithms.
    • A comparison sort.
    • An algorithm to remove negative values from an array of integers.
    • An algorithm to find the closest pair of a collection of points in the plane.
  9. Suppose that, given input of size \(n\), an algorithm requires at most \(5\log n+2n+14\) basic operations. How would we write the worst-case time efficiency of this algorithm?
  10. We discussed two circumstances in which we compute some kind of average of the efficiency of an algorithm: when we find average-case efficiency and when we find amortized efficiency. For each of these, explain what average is computed.
  11. Explain the difference between the asymptotic notations big-\(O\), \(\Omega\), and \(\Theta\).
  12. For each of the following, is the statement correct or incorrect?
    1. \(2n^3 - n \log n\) is \(O(n^2)\).
    2. \(2n^3 - n \log n\) is \(\Omega(n^2)\).
    3. \(2n^3 - n \log n\) is \(\Theta(n^2)\).
  13. True or false: big-\(O\) is about worst-case behavior, and \(\Omega\) is about best-case behavior. Explain.
  14. Suppose we are unsure whether \(2n + \log n\) or \(n \log n\) is of higher order. What could we compute, to determine which is greater?
  15. Factorials can be tricky to toss around when doing analysis of algorithms. What can we do about this?
  16. Rewrite summation notation as an ordinary sum (using “\(+\)”).
    Examples:
    • Rewrite \(\displaystyle \sum_{i=2}^{5}i^2\) as an ordinary sum.
    • Rewrite \(\displaystyle \sum_{i=1}^{6}100i\) as an ordinary sum.
  17. Rewrite an ordinary sum using summation notation.
    Examples:
    • Rewrite \(1 + 3 + 5 + 7 + 9 + 11 + 13 + 15\) using summation notation.
    • Rewrite \(12 + 22 + 32 + 42 + 52 + 62 + 72 + 82 + 92\) using summation notation.
  18. Evaluate a very simple summation.
    Examples:
    • Evaluate \(\displaystyle \sum_{i=1}^7 5\).
    • Evaluate \(\displaystyle \sum_{i=1}^3 k\).
    • Evaluate \(\displaystyle \sum_{i=0}^{n-1} 2\).
  19. Evaluate a large sum, given summation rules from Appendix A.
    Example:
    • Find \(2 + 4 + 6 + 8 + \cdots + 196 + 198 + 200\).
      Recall that \(\displaystyle \sum_{i=1}^n i = \frac{n(n+1)}{2}\)
      and \(\displaystyle \sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}\).
  20. What is a recurrence relation?
  21. State the Smoothness Rule.
  22. Given a second-order linear homogeneous recurrence with initial conditions, find the solution. You may assume this will not involve the text’s Case 3.
    Example:
    • Solve the following recurrence. \(x(n)=5x(n-1)-6x(n-2)\) for \(n\ge 2\). \(x(0)=3\). \(x(1)=8\).
  23. What do we mean by brute force?
  24. Explain how the Selection Sort algorithm works.
  25. Explain how the Bubble Sort algorithm works.
  26. The text claims that Selection Sort is “a better algorithm overall” than Bubble Sort. Explain.
  27. What is the Closest Pair Problem? (Not how to solve it; describe the problem itself.)
  28. What is the convex hull of a set of points?
  29. How can we informally describe the convex hull using a rubber band?
  30. What is the Convex Hull Problem?
  31. What is the Knapsack Problem?
  32. When we compute the convex hull of a given finite collection of points in the plane, we are finding a region in the plane. Desribing an arbitrary plane region is tricky; what actual data do we return?
  33. What does DFS stand for, and what does it mean?
  34. What does BFS stand for, and what does it mean?
  35. How does the Decrease and Conquer algorithmic strategy work?
  36. Give an example of an algorithm that uses the Decrease and Conquer strategy.
  37. What does DAG stand for, and what does it mean?
  38. What is a topological sort?
  39. Given a (small) digraph, give a topological sort, or explain why the digraph has no topological sort.
  40. Suppose that an algorithm is based on the Decrease and Conquer strategy, with the decrease proceeding by a constant factor. What thoughts do we have about the time efficiency of the algorithm?
  41. Explain how the Binary Search algorithm works.
  42. Discuss the efficiency of Binary Search: size of input, basic operation, order.
  43. Explain equality vs. equivalence.
  44. What is the selection problem?
  45. What is the average-case order of Quickselect? What is the worst-case order of Quickselect?
  46. How does the Divide and Conquer algorithmic strategy work?
  47. Give an example of an algorithm that uses the Divide and Conquer strategy.
  48. Explain how the Merge Sort algorithm works.
  49. A recursive algorithm splits its input into two nearly equal-sized parts. It makes a recursive call on each part, and it does \(\Theta(n^2)\) extra work, where \(n\) is the size of the input. Find the order of the algorithm.
  50. Explain how the Quicksort algorithm works.
  51. What is the (worst-case) order of Quicksort?
  52. Why can we not use the Master Theorem to analyze Quickselect or Quicksort?
  53. Describe a common way that Quicksort is optimized. What effect does this optimization have on Quicksort’s efficiency (time or space)?
  54. Without implementing our own stack, we cannot eliminate all recursive calls from Quicksort (as we can from Binary Search, Merge Sort, etc.). Why not?
  55. Explain the differences between preorder, inorder, and postorder traversals of Binary Trees.
  56. What does it mean to traverse a data structure?
  57. What do we generally expect the order of a traversal algorithm to be (for an arbitrary data structure)? What if we are traversing a graph?
  58. Given a diagram of a Binary Tree, write preorder, inorder, and postorder traversals of the tree.
  59. Explain the Transform and Conquer strategy.
  60. Give an example of an algorithm or technique that uses the Transform and Conquer strategy.
  61. Give an example of a situation in which presorting can improve the speed with which a problem can be solved.