原文地址: 哈密頓迴圈問題
解決Hamiltonian Cycle Problem算法問題,也就是哈密頓迴圈問題。算法
Simple-Quicksort uses the last element of the array as a pivot. Randomized-Quicksort uses a random array element as the pivot. In the worst-case both algorithms take O (n^2) time to sort an array.dom
NP-complete problems are considered unlikely to be in P because they can each be reduced to Satisfiability and Satisfiability can be reduced to any problem in NP (so they can all be reduced to each other). It is often difficult to determine if any given problem is NP-complete and we require formal reductions to actually prove this. However, even though a general problem such as Satisfiability may be NP-hard, simplified versions of the problem may be in P. For example, 3-Satisfiability is NP-complete while 2- Satisfiability (satisfiability restricted to 2 variables per clause) is in P.ide
Consider the Hamiltonian Cycle problem: "Given a graph G, does G have a simple cycle containing all of the vertices of G?" (Recall that a simple cycle contains no edge or vertex twice) This problem is NP-complete because it can be reduced from Vertex- Cover which can be reduced from 3-Satisfiability. Now consider each of the following modifications of Hamiltonian Cycle. Do you think it is NP-complete or in P? If you believe it is in P then give a brief description of a method that will answer the question in polynomial time. If you believe it is NP-complete then give a brief justification such as an NP-complete problem that reduces to this problem (formal reductions are technically required for this but outside of the scope of this course).ui
(本文出自csprojectedu.com,轉載請註明出處)this