Embercode
✕
Dynamic ProgrammingQuick quiz

Bitmask TSP

7 questions. Covers Bitmask DP: travelling salesman over subsets.

Questions 1 to 5 of 7

  1. 1. Which expression is the upper bound on the total work for n cities in the bitmask TSP table?
  2. 2. The lesson estimates the dp table for 20 cities at about how much memory?
  3. 3. Why is it enough to keep only the cheapest route for each (set, end city) pair?
  4. 4. In the 4-city example from the lesson, what does the program get if it takes the minimum of dp[full][last] without adding the trip back to city 0?
  5. 5. What does this program print? ``cpp #include <iostream> int main() { int mask = 0b1011; // cities 0, 1 and 3 std::cout << (mask & (1 << 1)) << " " << (mask | (1 << 2)) << " " << (mask ^ (1 << 3)) << std::endl; } ``

5 question(s) left on this page.