From: Brown Bannister on 30 Mar 2010 21:39 begin /* The following for-loop is the guessing stage*/ for i=1 to N do X[i] := choose(i); endfor /* Next is the verification stage */ Write code that does not use "choose" and verifies if X[1:N] is a correct solution to the problem. end Example of an NP problem: The Hamiltonian Cycle (HC) problem Input: A graph G Question: Does G have a Hamiltonian Cycle? Here is an NP algorithm for the HC problem: begin /* The following for-loop is the guessing stage*/ for i=1 to n do X[i] := choose(i); endfor /* Next is the verification stage */ for i=1 to n do for j=i+1 to n do if X[i] = X[j] then return(no); endif endfor endfor for i=1 to n-1 do if (X[i],X[i+1]) is not an edge then return(no); endif endfor if (X[n],X[1]) is not an edge then return(no); endif return(yes); end Here is an NP algorithm for the K-clique problem: begin /* The following for-loop is the guessing stage*/ for i=1 to k do X[i] := choose(i); endfor /* Next is the verification stage */ for i=1 to k do for j=i+1 to k do if (X[i] = X[j] or (X[i],X[j]) is not an edge) then return(no); endif endfor endfor return(yes); end Design a new algorithm AP as follows: Algorithm AP(input: IP) begin IR := T(IP); x := AR(IR); return x; end But we never do, we just keep going. --BB
From: George Jefferson on 30 Mar 2010 23:31 "How did I solve an NP-Complete problem in polynomial-time?" Very simple, you changed the laws of logic! Quite impressive!
From: H. J. Sander Bruggink on 31 Mar 2010 04:28 On 03/31/2010 03:39 AM, Brown Bannister wrote: > begin > /* The following for-loop is the guessing stage*/ > for i=1 to N do > X[i] := choose(i); > endfor > > > /* Next is the verification stage */ > Write code that does not use "choose" and > verifies if X[1:N] is a correct solution to the > problem. > end What is precisily the goal of your post? To explain the class of NP-problems? An NP-problem is defined to be a problem that can be solved in polynomial time (that's what the P is for) by a non-deterministic Turing Machine (that's what the N is for). It's not very surprising, therefore, that NP-problems can be solved in polynomial time by non-deterministic pseudocode. groente -- Sander
From: Brown Bannister on 31 Mar 2010 08:23 On Mar 30, 8:31 pm, "George Jefferson" <Geo...(a)Jefferson.com> wrote: > "How did I solve an NP-Complete problem in polynomial-time?" > > Very simple, you changed the laws of logic! Quite impressive! Thank you! From the above it follows by reading the operator we obtain the first character extracting different white characters. If you call scanf function, read the current character, whether it is white character or not. Note the difference between the two ways of reading may be removed if canceled skipws bit of member x_flags class ios (default value of this bit is one). If scanf function, field from reading begins with the first character different from white characters and ends when the next character is white, or no longer corresponds to the character format. When reading a string, maximum length of the field, reading, determine the width member function of class ios. It is true what is said about the width member function, but in this case value shall be construed as x_width maximum length of the field, reading, instead of the minimum length of the field in which is displayed. An important advantage of membership function width, versus scanf function is the current function width parameter may be any expression, while the value for scanf function may be only one constant. This will be used to eliminate errors (may occur because of reading a character more than the allocated memory). Consider the following example for illustration. Stream12.cpp file: # include <iostream.h> # include <conio.h> int main () ( clrscr (); char * t; int max; court << "max ="; cin>> max; t = new char [max], / / at most max-1 characters and / / Null character court << "Read up" <<max-1 << "characters)"; cin.width (max); cin>> t; court << "characters read are:" <<t; delete [] t; return 0; ) Run the program get the following result (s reveal data entry). max = 5 Read more than 4 characters: abcdefghij The characters read are: abcd It is noted although the entry has typed more characters, not to read more than the number of characters can save the space given string. If extraction operations may be used fillers defined in paragraph, except manipulator endl, ends, flush and setbase. Manipulator may be used only WAS operations of extraction. You may use other member functions of class ios, eg member function setf. The above is written and declared to be released to the public as intellectual property belonging to the author and creator. Signed, Martin Michael (BB is an alias to avoid hate mail, slightly) Los Angeles, California
From: Brown Bannister on 31 Mar 2010 08:41 On Mar 31, 1:28 am, "H. J. Sander Bruggink" <brugg...(a)uni-due.de> wrote: > On 03/31/2010 03:39 AM, Brown Bannister wrote: > > > begin > > /* The following for-loop is the guessing stage*/ > > for i=1 to N do > > X[i] := choose(i); > > endfor > > > /* Next is the verification stage */ > > Write code that does not use "choose" and > > verifies if X[1:N] is a correct solution to the > > problem. > > end > > What is precisily the goal of your post? To explain the class of > NP-problems? > > An NP-problem is defined to be a problem that can be solved in > polynomial time (that's what the P is for) by a non-deterministic Turing > Machine (that's what the N is for). It's not very surprising, therefore, > that NP-problems can be solved in polynomial time by non-deterministic > pseudocode. > > groente > -- Sander Dear Sander, The goal of my post is to stir the polynomial-time soup! To explain the class of NP-problems=An NP-problem is defined to be a problem solved in polynomial time by a non-deterministic Turing Machine. NP-problems can be solved in polynomial time by non- deterministic pseudocode. Algorithms can be described informally in pseudo-code. Good luck! .... Problem 7: Let M be a non-deterministic polynomial-time Turing machine. ... Problem 8: Recall that the configuration of a Turing machine is defined by a triple (q, w, u), ... NP-hard. Reducibility, and the notion of NP-completeness are defined. ... The far stronger result by Agrawal, Kayal, and Saxena this problem is in P is stated ... model of nondeterministic Turing machine (NTM) is defined formally. ... DO: Find a deterministic polynomial-time algorithm which, ... via reduction from the 3D-MATCHING problem (both problems were defined in class). .... solved in polynomial time all problems in NP may be solved in polynomial time. .... (non-algorithmic) definition of the array of problems considered. ... Correctly performing an algorithm will not solve a problem if the algorithm is flawed or not ... Success for this algorithm could then be defined as eventually outputting only ... NP denotes the class of decision problems that can be solved by a non-deterministic Turing machine in polynomial time. ... Software Glossary by M Altman set of steps may be used to solve a well-defined problem. .... The class P is the set of problems for which algorithms exist may solve any ... solvable in polynomial time by a non-deterministic Turing machine, ... problems in NP may have instances may be solved in polynomial time, and it may ... Describe in Turing Machine pseudocode a decider for the following language: ... What can you conclude about the class of languages accepted by 2-stack PDA's? ... First Algorithmic Problem: Given a non-deterministic Turing Machine M. ... Show that if P = NP then there is a polynomial time algorithm for ... the efficiency of polynomial time approximation schemes In particular, if FPT = W[ 1 ], then 3SAT can be solved in 20(") time [1] (where n ... A polynomial time approximation scheme (PTAS) for an NPO problem A is an algorithm .... We should derive a nondeterministic Turing machine executes the .... time approximation schemes for dense instances of NP-hard problems. ... Algorithms. MATLAB Programming Turing's initial interest was in the halting problem: deciding when an ... more: it includes the problems called NP-complete, which are generally presumed to take more than polynomial time for any (deterministic) algorithm. ... decision problems may be solved by a non-deterministic Turing machine in polynomial ... Analysis of Algorithms this problem may be solved if our data structure supports two operations: ...... formal way to talk about the set of problems may be solved in polynomial time, ... since for any DTM program we can run it on a non-deterministic machine, ... A problem in NP for which a polynomial time algorithm would imply all ... Quantum Computing [Exact Quantum Polynomial-Time Algorithm for Simon's Problem ... problem may be solved with certainty in worst-case polynomial time on the .... Characterization of Non-Deterministic Quantum Query and Quantum. ..... from quantum search (running on a quantum computer) for solving NP problems. ...
|
Next
|
Last
Pages: 1 2 Prev: A=1, B=2, C=3... Z=26 Next: Scientists Warn Large Earth Collider May Destroy Earth |