YUNOVA · Data Structures & Algorithms · Module 11: Advanced dynamic programming
Bitmask DP
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²).