Algorithm design and analysis
Warm-upHumanTwo sorted lists have lengths and . What is the largest number of comparisons the merging procedure can need to merge them?
Two sorted lists have lengths and . What is the largest number of comparisons the merging procedure can need to merge them?
What is the decision-tree lower bound on the worst-case number of comparisons needed to sort distinct items?
Mergesort's worst-case comparison count satisfies and for a power of two. Compute .
The network of towns in the Explore section has these cable costs: , , , , , , . Run Kruskal's algorithm. What is the total cost of the minimum spanning tree?
Run Dijkstra's algorithm from on the directed graph with edges (weight ), (weight ) and (weight ). What does it report for ?
In the proof of Theorem 5 (Dijkstra), which step uses the hypothesis that all edge weights are non-negative?
Suppose a currency has coins worth , and . For which amount does the greedy method (always use the largest coin that fits) not use the fewest coins?
What is the length of a longest common subsequence of AGGTAB and GXTXAYB?
Which specification correctly says that a Lean function sort : List ℕ → List ℕ is a sorting function? (Sorted l means each entry is ≤ the later ones; l₁ ~ l₂ means l₁ is a permutation of l₂.)
Write lcs_length(x, y) that returns the length of a longest common subsequence of the strings x and y, by filling the dynamic-programming table of Theorem 6 in time.