Difficult to solve the problem section in algorithm path
- This is a good book, including the string of data structures and the philosophical principles of operating systems.
- This book can be regarded as a simple example. The article is very good, and the author adds a lot of his own ideas.
- This article includes the hard-to-solve part.
Chapter 2 ease of solution and difficulty
- The easy solution refers to the polynomial problem, and the hard solution refers to the exponential problem.
- Decision Problems
- Yes/No
- If the answer is yes, a witness is usually required to prove it. A potential witness is proved to be a real witness.
- Mutual conversion between optimization and decision-making problems
- P Problems
- Deterministic polynomial time Solution
- For a decision-making problem, the input size is N, which can be solved within the polynomial time of N. Correct output is/No
- NP problems
- Non-deterministic polynomial time Solution
- For a decision-making problem, the potential witness with the size of N can be resolved within the polynomial time of N, and whether the witness is true
- The P-type question refers to the ability to give answers to polynomial time, And the NP-type question refers to the ability to determine whether a potential answer is correct within polynomial time.
- (Deterministic) Turing Machine
- The Turing machine is a state machine that determines the output, head movement direction, and next state based on the current state and next input character.
- Any problem or algorithm can be expressed as a string. Therefore, the Turing machine can solve many problems.
- Uncertain Turing Machine
- Compared with the deterministic Turing machine, a given State and input can have multiple options
- Able to enter all status paths at the same time, and make the best choice to reach the acceptance status
- Non-deterministic algorithms: algorithms run on non-deterministic Turing Machines
- Another definition of the NP problem: using non-deterministic algorithms to solve the problem in polynomial time
- Relationship between P and NP
- All P-type problems are NP
- All NP is not necessarily P, intuition is so, but it cannot be proved
- Some NP is P, and polynomial solutions have been found. Currently, NP problems with polynomial solutions are called NP-hard.
Chapter 2 NP complete Problems
- If every problem in NP can be reduced to S by polynomial time, S is called NP hard (strictly defined ). S is no easier than any problem in NP
- If the problem s is both an NP-hard and an NP-internal problem, it is called an NP-complete problem.
- NP full attributes
- Non-deterministic algorithm polynomial time Solution
- Complete: solves all NP-complete problems.
- If we find a deterministic solution to the NP complete problem, we prove that Np = P
- If a polynomial time solution for NP-hard optimization is found, NP = P is proved.
- NP completeness: if a problem can be proved to be an NP-complete problem, no more precise solutions are needed to find an enlightening approximate solution.
- Common NP problems
- 3-Sat
- Integer Segmentation
- Vertex Overwrite
- Hamilton circuit can be reduced to the traveling salesman problem
- Full subgraph
- Graph Coloring
- Traveling Salesman
- Integer Programming is an NP-hard problem, but it is not an NP-hard problem. Therefore, it is not an NP-complete problem.
Chapter 1 no solution and Approximation
- NP is only the most difficult problem in NP. Currently, polynomial solutions are not found.
- Difficult to solve the problem without polynomial solution
- The problem cannot be decided: there is no solution, and even the index level does not help. But potential witnesses
- For NP-complete and hard-to-solve problems, we can try to find sub-optimal solutions.
- Smart effort
- Optimal Solution
- Two pruning strategies: backtracking and branch Restriction
- For example, eight queens
- Approximation Algorithm
- Approximate solution can be found
- Such as clustering problems, heuristic search, simulated annealing, Genetic Algorithms
- Local Search
- A greedy strategy
- Moving continuously to a better feasible solution may only find the local optimal solution
For more information, see focustc. The blog address is http://blog.csdn.net/caozhk.