YUNOVA · Data Structures & Algorithms · Module 11: Advanced dynamic programming

Bitmask DP

Notes for offline study · 30 November 2026

Bitmask DP

Key points

  • A bitmask stores which items of a small set are chosen as bits of an integer.
  • Bitmask DP suits n up to about 20, since there are 2^n states.
  • Travelling salesman uses dp[mask][last], solved in O(2^n · n²).

Free on YUNOVA · yunova.in · Sign in to add your own lesson notes to this sheet.

Notes: Bitmask DP | YUNOVA