Skip to content
Embercode
✕
DP optimisationsQuick quiz

Trees and knapsack

8 questions. Covers Knapsack variants and bounded knapsack, three ways to count copies.

Questions 1 to 5 of 8

  1. 1. A teammate says the tree knapsack merge is O(n^2) because the tree has only n nodes. Which reason is the real one?
  2. 2. You need the farthest weighted distance from every node of a tree, with n = 100000. Which method gives all the answers in O(n) total?
  3. 3. Binary splitting replaces a count c with 0/1 pieces of sizes 1, 2, 4 and so on, with the last piece taking what is left. How many pieces does a count of c = 37 need?

    Type a number.

  4. 4. An AI tool split a count of c = 5 into the pieces 1, 2 and 4, then ran the 0/1 knapsack over them. The judge says it can take 7 copies of an item that only has 5. What is the fix?
  5. 5. Which statements about the bitset subset-sum method are true?

    Pick every answer that is true.

5 question(s) left on this page.

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