Skip to content
Embercode
✕
DP optimisationsQuick quiz

Divide and conquer and Knuth

8 questions. Covers Knuth optimisation.

Questions 1 to 5 of 8

  1. 1. An AI assistant wrote a divide and conquer solver. Each block costs (sum of its weights) squared. The solver is run on the weights -3 -9 -6 -6 7 0, cut into k = 3 blocks. It prints 169. Brute force over all cuts gives 115. The solver printed no warning. What is the most likely cause?
  2. 2. Four piles hold 4, 1, 3 and 2 stones, in that row. You may merge two neighbouring piles, and each merge costs the total stones in the new pile. What is the smallest total cost to merge all four into one pile?

    Type a number.

  3. 3. Which statements about Knuth's bound for interval DP are true? Select all that apply.

    Pick every answer that is true.

  4. 4. Put these steps in the order to follow before you trust a divide and conquer speed-up for a layered DP.

    Use the arrows to put the steps in order.

    1. 1.Check the quadrangle inequality by algebra or over every quadruple a ≤ b ≤ c ≤ d
    2. 2.Compare the fast solver with a brute-force checker on small random inputs
    3. 3.Use the fast solver on the full input size
    4. 4.Write the block cost as a function w(j, i)
  5. 5. Match each DP to its work bound. Here n is the number of items and k is the number of blocks.

    Choose the matching item for each row.

4 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.