Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)Polynomial-time algorithm with exponential space is eligible?How can an algorithm have exponential space complexity but polynomial time complexity?Pseudo-polynomial time algorithm for NP-Complete ProblemsIf the decision problem can be solved in poly time, show the optimization problem also canCan any finite problem be in NP-Complete?Could Subset Sum Problem Be Solved In linear Time Using Logarithmic Space?Could be solved a NP-complete problem in constant time?3SAT solvable in polynomial time…but with exponential tuning?Any algorithm polynomial time with infinite space?Is there an NP-complete problem that can be solved in $O(n^log n)$ time?
When can you leave off “le/la” to say “it” in French?
"Выиграть соперника": Is it correct, or why do many journalists write in this way?
Count All Possible Unique Combinations of Letters in a Word
What did River say when she woke from her proto-comatose state?
What reason would an alien civilization have for building a Dyson Sphere (or Swarm) if cheap Nuclear fusion is available?
"How can you guarantee that you won't change/quit job after just couple of months?" How to respond?
What could exist inside and between the walls of a Dyson Sphere?
What's currently blocking the construction of the wall between Mexico and the US?
Understanding the reasoning of the woman who agreed with King Solomon to "cut the baby in half"
Greeting with "Ho"
Why do textbooks often include the solutions to odd or even numbered problems but not both?
Why don't countries like Japan just print more money?
Why tighten down in a criss-cross pattern?
Is it damaging to turn off a small fridge for two days every week?
Is a single radon-daughter atom in air a solid?
Silly doubt about tidal effects and Einstein Field Equations
What exactly is the 'online' in OLAP and OLTP?
Can White Castle?
Why do all the teams that I have worked with always finish a sprint without completion of all the stories?
Is this proposal by U.S. presidential candidate Pete Buttigieg to change the composition of the Supreme Court constitutional?
Drawing people along with x and y axis
Do I need a shock-proof watch for cycling?
What does the hyphen "-" mean in "tar xzf -"?
What can I do with a research project that is my university’s intellectual property?
Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)
Polynomial-time algorithm with exponential space is eligible?How can an algorithm have exponential space complexity but polynomial time complexity?Pseudo-polynomial time algorithm for NP-Complete ProblemsIf the decision problem can be solved in poly time, show the optimization problem also canCan any finite problem be in NP-Complete?Could Subset Sum Problem Be Solved In linear Time Using Logarithmic Space?Could be solved a NP-complete problem in constant time?3SAT solvable in polynomial time…but with exponential tuning?Any algorithm polynomial time with infinite space?Is there an NP-complete problem that can be solved in $O(n^log n)$ time?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I read about NPC and its relationship to PSPACE and I wish to know whether NPC problems can be deterministicly solved using an algorithm with worst case polynomial space requirement, but potentially taking exponential time (2^P(n) where P is polynomial).
Moreover, can it be generalised to EXPTIME in general?
The reason I am asking this is that I wrote some programs to solve degenerate cases of an NPC problem, and they can consume very large amounts of RAM for hard instances, and I wonder if there is a better way. For reference see https://fc-solve.shlomifish.org/faq.html .
complexity-theory np-complete np
New contributor
$endgroup$
add a comment |
$begingroup$
I read about NPC and its relationship to PSPACE and I wish to know whether NPC problems can be deterministicly solved using an algorithm with worst case polynomial space requirement, but potentially taking exponential time (2^P(n) where P is polynomial).
Moreover, can it be generalised to EXPTIME in general?
The reason I am asking this is that I wrote some programs to solve degenerate cases of an NPC problem, and they can consume very large amounts of RAM for hard instances, and I wonder if there is a better way. For reference see https://fc-solve.shlomifish.org/faq.html .
complexity-theory np-complete np
New contributor
$endgroup$
add a comment |
$begingroup$
I read about NPC and its relationship to PSPACE and I wish to know whether NPC problems can be deterministicly solved using an algorithm with worst case polynomial space requirement, but potentially taking exponential time (2^P(n) where P is polynomial).
Moreover, can it be generalised to EXPTIME in general?
The reason I am asking this is that I wrote some programs to solve degenerate cases of an NPC problem, and they can consume very large amounts of RAM for hard instances, and I wonder if there is a better way. For reference see https://fc-solve.shlomifish.org/faq.html .
complexity-theory np-complete np
New contributor
$endgroup$
I read about NPC and its relationship to PSPACE and I wish to know whether NPC problems can be deterministicly solved using an algorithm with worst case polynomial space requirement, but potentially taking exponential time (2^P(n) where P is polynomial).
Moreover, can it be generalised to EXPTIME in general?
The reason I am asking this is that I wrote some programs to solve degenerate cases of an NPC problem, and they can consume very large amounts of RAM for hard instances, and I wonder if there is a better way. For reference see https://fc-solve.shlomifish.org/faq.html .
complexity-theory np-complete np
complexity-theory np-complete np
New contributor
New contributor
New contributor
asked 8 hours ago
Shlomi FishShlomi Fish
1234
1234
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
$mathbfNP$ $subseteq mathbfPSPACE$
The statemement is known as part of the relations between the classes, as depicted by the following diagram:
The explanation is simple: a problem $Q$ $in$ $mathbfNP$ has a polynomial length certificate $y$. An algorithm that tests all possible certificates is an algorithm that decides $Q$ in time $large 2^n^O(1)$.
Its space requirement is:
$y$ (polynomial in $n$)- space required to verify $y$. Since $y$ is a polynomial certificate, it can be verified in polynomial time, hence cannot possibly require more than polynomial space.
Since the sum of two polynomials is also a polynomial, $Q$ can be decided with polynomial space.
Example:
Suppose $varphi$ is an instance of 3-CNF on literals $x_1 dots x_n$, with $m$ clauses. An assignment $f$ is some function $f:x_1dots x_n rightarrow 0,1$.
It holds that:
- There are $2^n$ different assignments.
- Given an assignment $f$, it takes $O(m)$ time to calculate the value of $varphi$, therefore it cannot require more than $O(m)$ space.
So an algorithm $A$ that checks all possible assignments will use polynomial space, run in exponential time and decide 3-SAT.
It follows that:
3-SAT $in mathbfPSPACE$, and since 3-SAT is NP-Complete, $mathbfNP$ $subseteq mathbfPSPACE$
$endgroup$
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
|
show 1 more comment
$begingroup$
Yes. Here's a sketch of a direct proof.
If a problem is in $mathrmNP$, there is a nondeterministic Turing machine $M$ that decides it, and there's a polynomial $p$ such that none of $M$'s computation paths on inputs of length $n$ take more than $p(n)$ steps. That means that a single path can't use more than $p(n)$ tape cells, so we can simulate a single path deterministically in polynomial space.
But we need to simulate all the paths. Well, there is a constant $c$ that depends only on the transition function of $M$ (and not on its input) such that $M$ has at most $c$ nondeterministic choices at any step. That means that there are at most $c^p(n)$ different computation paths for any input of length $n$. We can simulate all of these $c^p(n)$ paths as follows. First, write out a $p(n)$-digit number in base-$c$ (this takes space $p(n)$ but that's polynomial, so it's OK). Then, simulate the operation of $M$ and, at the $i$th step of the computation, use the $i$th digit of the number to decide which nondeterministic choice to make. If, for example, the $i$th digit is $6$ and there are only four choices that can be made, abandon that simulation and go on to the next one.
So, now, to do the whole simulation, we start by writing out the number $0dots 0$, simulate that path of $M$, increment the number, simulate the next path, and so on, until we reach the number where every digit is $c-1$. We've now simulated every possible computation path, and we've done it in time about $c^p(n)p(n)$, using space about $2p(n)$. That's exponential time and polynomial space, as required.
$endgroup$
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "419"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Shlomi Fish is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f110923%2fcan-any-np-complete-problem-be-solved-using-at-most-polynomial-space-but-while%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
$mathbfNP$ $subseteq mathbfPSPACE$
The statemement is known as part of the relations between the classes, as depicted by the following diagram:
The explanation is simple: a problem $Q$ $in$ $mathbfNP$ has a polynomial length certificate $y$. An algorithm that tests all possible certificates is an algorithm that decides $Q$ in time $large 2^n^O(1)$.
Its space requirement is:
$y$ (polynomial in $n$)- space required to verify $y$. Since $y$ is a polynomial certificate, it can be verified in polynomial time, hence cannot possibly require more than polynomial space.
Since the sum of two polynomials is also a polynomial, $Q$ can be decided with polynomial space.
Example:
Suppose $varphi$ is an instance of 3-CNF on literals $x_1 dots x_n$, with $m$ clauses. An assignment $f$ is some function $f:x_1dots x_n rightarrow 0,1$.
It holds that:
- There are $2^n$ different assignments.
- Given an assignment $f$, it takes $O(m)$ time to calculate the value of $varphi$, therefore it cannot require more than $O(m)$ space.
So an algorithm $A$ that checks all possible assignments will use polynomial space, run in exponential time and decide 3-SAT.
It follows that:
3-SAT $in mathbfPSPACE$, and since 3-SAT is NP-Complete, $mathbfNP$ $subseteq mathbfPSPACE$
$endgroup$
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
|
show 1 more comment
$begingroup$
$mathbfNP$ $subseteq mathbfPSPACE$
The statemement is known as part of the relations between the classes, as depicted by the following diagram:
The explanation is simple: a problem $Q$ $in$ $mathbfNP$ has a polynomial length certificate $y$. An algorithm that tests all possible certificates is an algorithm that decides $Q$ in time $large 2^n^O(1)$.
Its space requirement is:
$y$ (polynomial in $n$)- space required to verify $y$. Since $y$ is a polynomial certificate, it can be verified in polynomial time, hence cannot possibly require more than polynomial space.
Since the sum of two polynomials is also a polynomial, $Q$ can be decided with polynomial space.
Example:
Suppose $varphi$ is an instance of 3-CNF on literals $x_1 dots x_n$, with $m$ clauses. An assignment $f$ is some function $f:x_1dots x_n rightarrow 0,1$.
It holds that:
- There are $2^n$ different assignments.
- Given an assignment $f$, it takes $O(m)$ time to calculate the value of $varphi$, therefore it cannot require more than $O(m)$ space.
So an algorithm $A$ that checks all possible assignments will use polynomial space, run in exponential time and decide 3-SAT.
It follows that:
3-SAT $in mathbfPSPACE$, and since 3-SAT is NP-Complete, $mathbfNP$ $subseteq mathbfPSPACE$
$endgroup$
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
|
show 1 more comment
$begingroup$
$mathbfNP$ $subseteq mathbfPSPACE$
The statemement is known as part of the relations between the classes, as depicted by the following diagram:
The explanation is simple: a problem $Q$ $in$ $mathbfNP$ has a polynomial length certificate $y$. An algorithm that tests all possible certificates is an algorithm that decides $Q$ in time $large 2^n^O(1)$.
Its space requirement is:
$y$ (polynomial in $n$)- space required to verify $y$. Since $y$ is a polynomial certificate, it can be verified in polynomial time, hence cannot possibly require more than polynomial space.
Since the sum of two polynomials is also a polynomial, $Q$ can be decided with polynomial space.
Example:
Suppose $varphi$ is an instance of 3-CNF on literals $x_1 dots x_n$, with $m$ clauses. An assignment $f$ is some function $f:x_1dots x_n rightarrow 0,1$.
It holds that:
- There are $2^n$ different assignments.
- Given an assignment $f$, it takes $O(m)$ time to calculate the value of $varphi$, therefore it cannot require more than $O(m)$ space.
So an algorithm $A$ that checks all possible assignments will use polynomial space, run in exponential time and decide 3-SAT.
It follows that:
3-SAT $in mathbfPSPACE$, and since 3-SAT is NP-Complete, $mathbfNP$ $subseteq mathbfPSPACE$
$endgroup$
$mathbfNP$ $subseteq mathbfPSPACE$
The statemement is known as part of the relations between the classes, as depicted by the following diagram:
The explanation is simple: a problem $Q$ $in$ $mathbfNP$ has a polynomial length certificate $y$. An algorithm that tests all possible certificates is an algorithm that decides $Q$ in time $large 2^n^O(1)$.
Its space requirement is:
$y$ (polynomial in $n$)- space required to verify $y$. Since $y$ is a polynomial certificate, it can be verified in polynomial time, hence cannot possibly require more than polynomial space.
Since the sum of two polynomials is also a polynomial, $Q$ can be decided with polynomial space.
Example:
Suppose $varphi$ is an instance of 3-CNF on literals $x_1 dots x_n$, with $m$ clauses. An assignment $f$ is some function $f:x_1dots x_n rightarrow 0,1$.
It holds that:
- There are $2^n$ different assignments.
- Given an assignment $f$, it takes $O(m)$ time to calculate the value of $varphi$, therefore it cannot require more than $O(m)$ space.
So an algorithm $A$ that checks all possible assignments will use polynomial space, run in exponential time and decide 3-SAT.
It follows that:
3-SAT $in mathbfPSPACE$, and since 3-SAT is NP-Complete, $mathbfNP$ $subseteq mathbfPSPACE$
answered 7 hours ago
loxlox
1,107211
1,107211
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
|
show 1 more comment
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
Why are EXPSPACE and EXPTIME related? I thought time and space were different resources. One example which comes to mind is breaking a crypto scheme, which would require EXPTIME, but constant space
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
The intuitive here is, if you use $f(n)$ space, you must use at least $f(n)$ time, and you shouldn't use more than $2^f(n)$ time, because then you must be revisitting the same states. That's why PSPACE $subseteq $ EXP
$endgroup$
– lox
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
Is f(n) different to O(n) in your example?
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
$f(n)$ is any time function of $n$. It can be $n^2$ or $nlog n$
$endgroup$
– lox
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
$begingroup$
Oh right, so even though we are discarding the "bad" results when breaking a crypto scheme. If we were to not discard them, they would add up to f(n) space. Hope that's correct
$endgroup$
– WeCanBeFriends
2 hours ago
|
show 1 more comment
$begingroup$
Yes. Here's a sketch of a direct proof.
If a problem is in $mathrmNP$, there is a nondeterministic Turing machine $M$ that decides it, and there's a polynomial $p$ such that none of $M$'s computation paths on inputs of length $n$ take more than $p(n)$ steps. That means that a single path can't use more than $p(n)$ tape cells, so we can simulate a single path deterministically in polynomial space.
But we need to simulate all the paths. Well, there is a constant $c$ that depends only on the transition function of $M$ (and not on its input) such that $M$ has at most $c$ nondeterministic choices at any step. That means that there are at most $c^p(n)$ different computation paths for any input of length $n$. We can simulate all of these $c^p(n)$ paths as follows. First, write out a $p(n)$-digit number in base-$c$ (this takes space $p(n)$ but that's polynomial, so it's OK). Then, simulate the operation of $M$ and, at the $i$th step of the computation, use the $i$th digit of the number to decide which nondeterministic choice to make. If, for example, the $i$th digit is $6$ and there are only four choices that can be made, abandon that simulation and go on to the next one.
So, now, to do the whole simulation, we start by writing out the number $0dots 0$, simulate that path of $M$, increment the number, simulate the next path, and so on, until we reach the number where every digit is $c-1$. We've now simulated every possible computation path, and we've done it in time about $c^p(n)p(n)$, using space about $2p(n)$. That's exponential time and polynomial space, as required.
$endgroup$
add a comment |
$begingroup$
Yes. Here's a sketch of a direct proof.
If a problem is in $mathrmNP$, there is a nondeterministic Turing machine $M$ that decides it, and there's a polynomial $p$ such that none of $M$'s computation paths on inputs of length $n$ take more than $p(n)$ steps. That means that a single path can't use more than $p(n)$ tape cells, so we can simulate a single path deterministically in polynomial space.
But we need to simulate all the paths. Well, there is a constant $c$ that depends only on the transition function of $M$ (and not on its input) such that $M$ has at most $c$ nondeterministic choices at any step. That means that there are at most $c^p(n)$ different computation paths for any input of length $n$. We can simulate all of these $c^p(n)$ paths as follows. First, write out a $p(n)$-digit number in base-$c$ (this takes space $p(n)$ but that's polynomial, so it's OK). Then, simulate the operation of $M$ and, at the $i$th step of the computation, use the $i$th digit of the number to decide which nondeterministic choice to make. If, for example, the $i$th digit is $6$ and there are only four choices that can be made, abandon that simulation and go on to the next one.
So, now, to do the whole simulation, we start by writing out the number $0dots 0$, simulate that path of $M$, increment the number, simulate the next path, and so on, until we reach the number where every digit is $c-1$. We've now simulated every possible computation path, and we've done it in time about $c^p(n)p(n)$, using space about $2p(n)$. That's exponential time and polynomial space, as required.
$endgroup$
add a comment |
$begingroup$
Yes. Here's a sketch of a direct proof.
If a problem is in $mathrmNP$, there is a nondeterministic Turing machine $M$ that decides it, and there's a polynomial $p$ such that none of $M$'s computation paths on inputs of length $n$ take more than $p(n)$ steps. That means that a single path can't use more than $p(n)$ tape cells, so we can simulate a single path deterministically in polynomial space.
But we need to simulate all the paths. Well, there is a constant $c$ that depends only on the transition function of $M$ (and not on its input) such that $M$ has at most $c$ nondeterministic choices at any step. That means that there are at most $c^p(n)$ different computation paths for any input of length $n$. We can simulate all of these $c^p(n)$ paths as follows. First, write out a $p(n)$-digit number in base-$c$ (this takes space $p(n)$ but that's polynomial, so it's OK). Then, simulate the operation of $M$ and, at the $i$th step of the computation, use the $i$th digit of the number to decide which nondeterministic choice to make. If, for example, the $i$th digit is $6$ and there are only four choices that can be made, abandon that simulation and go on to the next one.
So, now, to do the whole simulation, we start by writing out the number $0dots 0$, simulate that path of $M$, increment the number, simulate the next path, and so on, until we reach the number where every digit is $c-1$. We've now simulated every possible computation path, and we've done it in time about $c^p(n)p(n)$, using space about $2p(n)$. That's exponential time and polynomial space, as required.
$endgroup$
Yes. Here's a sketch of a direct proof.
If a problem is in $mathrmNP$, there is a nondeterministic Turing machine $M$ that decides it, and there's a polynomial $p$ such that none of $M$'s computation paths on inputs of length $n$ take more than $p(n)$ steps. That means that a single path can't use more than $p(n)$ tape cells, so we can simulate a single path deterministically in polynomial space.
But we need to simulate all the paths. Well, there is a constant $c$ that depends only on the transition function of $M$ (and not on its input) such that $M$ has at most $c$ nondeterministic choices at any step. That means that there are at most $c^p(n)$ different computation paths for any input of length $n$. We can simulate all of these $c^p(n)$ paths as follows. First, write out a $p(n)$-digit number in base-$c$ (this takes space $p(n)$ but that's polynomial, so it's OK). Then, simulate the operation of $M$ and, at the $i$th step of the computation, use the $i$th digit of the number to decide which nondeterministic choice to make. If, for example, the $i$th digit is $6$ and there are only four choices that can be made, abandon that simulation and go on to the next one.
So, now, to do the whole simulation, we start by writing out the number $0dots 0$, simulate that path of $M$, increment the number, simulate the next path, and so on, until we reach the number where every digit is $c-1$. We've now simulated every possible computation path, and we've done it in time about $c^p(n)p(n)$, using space about $2p(n)$. That's exponential time and polynomial space, as required.
answered 6 hours ago
David RicherbyDavid Richerby
72.9k16114202
72.9k16114202
add a comment |
add a comment |
Shlomi Fish is a new contributor. Be nice, and check out our Code of Conduct.
Shlomi Fish is a new contributor. Be nice, and check out our Code of Conduct.
Shlomi Fish is a new contributor. Be nice, and check out our Code of Conduct.
Shlomi Fish is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Computer Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f110923%2fcan-any-np-complete-problem-be-solved-using-at-most-polynomial-space-but-while%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown