The fifth metacarpal practice report

First, the understanding of the backtracking algorithm

In my understanding, the backtracking is to issue as a "tree" and its dfs, until you find the answer should be noted that in the backtracking, the need for pruning, with bounding function and specific topics pruning rule, it was able to reduce the time complexity.

Second, the " solution space structure and subset" constraint function issues and

       "Subset and the" solution space structure "knapsack" Similar problems, respect to the number n, the solution space that contains all possible variable assignment 0-1. "1" represents selection of the number, "0" represents the number is not selected.

       Its function as a constraint for the i-th selection, there is the election and not vote, if all the numbers after the election of the whole into account, are lower than the target value, then it can not continue to traverse the reason that seeking a prefix and, every judge on the line.

void DFS ( int CNT, int NUM) {
     IF (SUM [CNT] + NUM <N) { // This is the constraint functions 
        return ; 
    } 
  ... }

 

Third, the encounter in this chapter the learning process and the issue of programming knot case

  In the algorithm big job, and I do Huang Xiaoyu experience a feeling of the game, but not enough experience in Chennai, the transformation of Tetris AI algorithms without success, but two people programming capabilities have been greatly enhanced, hope this winter the completion of the project.

Guess you like

Origin www.cnblogs.com/qq2210446939/p/12070729.html