Algorithm Design and Analysis Spring 2026 Final Exam

Last updated on June 28, 2026 am

This article is currently an experimental machine translation and may contain errors. If anything is unclear, please refer to original Chinese version. I am continuously working to improve the translation.

Multiple Choice (select all that apply) 15*2%

No partial credit: selecting too few, too many, omitting, or choosing wrong options all result in zero points

Key points: stability of sorting algorithms, which problem-solving approach each belongs to

Which problems belong to which problem-solving approaches (e.g., merge sort belongs to divide and conquer)

I can't remember the exact questions, but here's what you can do: send this Prompt to an LLM:

Here is the exam format for our course:

Algorithms Course Exam Format

Question 1: Multiple choice (select all that apply), 15 questions, 2 points each, 30 points total. Four options, you may select 1~4 of them; selecting too few, too many, omitting, or choosing wrong options all result in zero points

Question 2: Short answer questions, 4 questions, 28 points total.

Question 3: Algorithm application questions, 4 questions, 42 points total.

Review and Answering Tips

For short answer questions, be sure to stick to the core of the question and write only keywords. Don't ramble or pad your answer with extra words to earn points. If you can't reach the core idea, move on to other questions quickly.

For algorithm application questions that ask for the algorithm's idea, if the question doesn't specify a format, you're free to choose (pseudocode, flowcharts, natural language, or code are all acceptable); if the question explicitly requires a specific format, follow it.

Please first help me generate 30 multiple-choice questions (select all that apply), mostly focused on testing concepts. I want to practice on my own. Ideally I'd like it to be interactive; if that's not possible, you can also give me the questions and answers separately.

Combined with the lecture slides, this can generate multiple-choice questions very similar to the exam ones (personally tested).

Short Answer Questions 28%

1

  1. Briefly describe the ideas behind divide and conquer and decrease and conquer
  2. Give two examples of each

2

  1. What two conditions must a problem satisfy to be solvable by dynamic programming?
  2. Explain these two conditions

3

Consider the classic coin change problem with denominations [1, 3, 4], needing to make change for 6 yuan with the fewest coins:

  1. Solve it using a greedy approach, explain the greedy idea, and give the result
  2. Give the correct result
  3. Explain why the greedy approach fails to get the correct result

4

  1. Explain the difference between branch and bound and backtracking
  2. Give one example problem each that can be solved with these two methods
  3. Explain why branch and bound is usually more efficient

Algorithm Questions 42%

I can't remember the exact data given; the AI made it up, but the meaning of the questions is correct.

1 8%

A driver is driving along a road with n toll booths. Arriving at the i-th toll booth requires paying a fee of cost[i]. The driver can move forward past at most 1 or 2 toll booths at a time. Design a dynamic programming algorithm to find the minimum cost of reaching the n-th toll booth.

2 14%

A company has several independent projects to complete. Each project yields a certain bonus upon completion, but the project must be completed before or on its deadline to earn the corresponding bonus. Each project requires 1 full day of continuous work to complete, and at most 1 project can be completed per day. If a project is not completed before its deadline, its bonus cannot be earned.

There are currently 7 projects, with deadlines and bonuses shown in the table below:

Project Deadline (d_i) Bonus (p_i)
A 1 35
B 2 30
C 2 25
D 1 20
E 3 45
F 3 15
G 2 40

Please complete the following:

(1) Formulate a mathematical model. Abstract the problem into an optimization problem, define the necessary variables, and state what the constraints are and what the optimization objective is.

(2) Design an efficient algorithm. Design an efficient algorithm to solve this problem so that the total bonus earned is maximized while satisfying the deadline constraints. Explain the basic idea and specific steps of the algorithm.

(3) Solve the above instance using your algorithm. Following the algorithm from part (2), schedule the 7 projects in the table, write out the selection process at each step, and finally give the order of projects to be completed and the maximum bonus obtainable.

(4) Analyze the algorithm's complexity. Analyze the time complexity of your algorithm.

3 10%

Problem: The Inversion Count of a Sequence of Positive Integers

Given a sequence of positive integers of length $n$: $$ A = (a_1, a_2, \dots, a_n) $$ If there exists a pair of indices $(i, j)$ such that:

$1 \leq i < j \leq n$ and $a_i > a_j$

then $(a_i, a_j)$ is called an inversion pair in the sequence. The total number of all inversion pairs in the sequence is called the inversion count of the sequence.

For example, for the sequence:

$A = (7, 3, 5, 2, 6, 1)$

there are several inversion pairs, such as $(7,3)$, $(7,5)$, $(3,2)$, $(6,1)$, etc. The task is to compute the inversion count of this sequence.

Please complete the following:

(1) Brute-force approach and complexity analysis. Explain how to compute the inversion count of a given sequence of positive integers using a brute-force approach, and analyze the time complexity of this method.

(2) Design an efficient algorithm. Design an algorithm more efficient than the brute-force approach to solve this problem. Explain the basic idea and specific steps of the algorithm.

(3) Recurrence relation and complexity analysis. Based on the algorithm designed in part (2), write out the recurrence relation for its time complexity, solve the recurrence, and obtain the asymptotic time complexity of the algorithm.

4 10%

A company plans to select several projects from 6 candidate R&D projects for investment. Once a project is selected, its full required budget must be invested—partial investment is not allowed; each project can be selected at most once. The company's total budget available for R&D projects this year is 200,000 yuan.

The required budgets and expected output values of each project are shown in the table below:

Project Required Budget Expected Output Value
A 7 49
B 4 40
C 8 40
D 5 45
E 3 18
F 6 48

The requirement is to select several projects such that the total expected output value is maximized, subject to the total budget not exceeding 20.

(1) Use a dynamic programming algorithm to solve for the maximum output value of this problem. You are required to give the state representation, the state transition equation, and the boundary conditions.

(2) Use priority-queue-based branch and bound to solve this problem. You are required to design an appropriate node priority function or bounding function yourself, and explain why this function can serve as an upper bound during the search. Each node should contain at least: the index of the project currently being considered, the budget used so far, the output value obtained so far, the current upper bound on value, and the set of projects already selected.

During the search, use a max-priority queue to hold the live nodes, selecting the node with the highest priority as the next node to expand each time. Write out the main search process, explain which nodes can be pruned, and finally give the optimal set of projects and the maximum output value.


Algorithm Design and Analysis Spring 2026 Final Exam
https://blog.wendain.ing/en/posts/algorithm-sp26-final/
Author
wendaining
Posted on
June 25, 2026
Updated on
June 28, 2026
Licensed under