Skip to content
StackDecode
Dynamic programmingExplained

Bitmask DP

Encode which items are used as bits in an integer state.

Time

O(2ⁿ · n)

Extra space

O(2ⁿ)

Use it for

Small sets: assignment, TSP.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.