what is dp?how this dp[mask][pos] changed the complexity. and why did we used it?
Dynamic programming use
dp is our memo table that we save our answers to the subproblems so we dont calculate the same subproblem again and again and again.
dp[mask][pos] ==> the minimum weighted path that we can get to the first vertex(based on hamilton cycle) from the vertex pos that we visit all of the vertex that are setted 0 in the mask.
dp is dynamic programming
there are 2 ways to do it
top down approach-> Recursion + memoization
bottom up approach
dp[a][b] use to store a result which have been caculated and is used for the futhur calculation
like if we have to solve 2 equation f1 and f2f1
know if we solve f1 and store its result
then in solving f2f1 we don’t waste our time to solve f1 that save our time
same dp[a][b] does
hope it help