patternMinor
NL- definition and a problem
Viewed 0 times
definitionproblemand
Problem
The question is: What is the smallest complexity class in which the following problem is contained: Given a graph with $n$ nodes, Is there independent set of size of at least $n-10$?
I have a little difficulty to understand the meaning of being in ${\sf L}$ and examine problems in a correct way for deciding if they are in ${\sf NL}$ or ${\sf L}$
First I know that for being in ${\sf NL}$ I need to provide a verifier for a Turing machine which uses only $O(\log n)$ space on its working tape- So I wonder- I can give as a verifier this set of nodes to be independent set as requested, but how does the checking work? Can it go to all the lists of the pointers to the neighbors of each node , and for every node to check whether all the other nodes in the set given as independent set is not on that list- Is this considered of not using any space and I only need to count the nodes in the list that fulfill the requirement and therefore use only $O(\log n)$ space? Is this correct? Is there a way to prove that the problem is in ${\sf L}$?
I have a little difficulty to understand the meaning of being in ${\sf L}$ and examine problems in a correct way for deciding if they are in ${\sf NL}$ or ${\sf L}$
First I know that for being in ${\sf NL}$ I need to provide a verifier for a Turing machine which uses only $O(\log n)$ space on its working tape- So I wonder- I can give as a verifier this set of nodes to be independent set as requested, but how does the checking work? Can it go to all the lists of the pointers to the neighbors of each node , and for every node to check whether all the other nodes in the set given as independent set is not on that list- Is this considered of not using any space and I only need to count the nodes in the list that fulfill the requirement and therefore use only $O(\log n)$ space? Is this correct? Is there a way to prove that the problem is in ${\sf L}$?
Solution
Hint: How much space do you need to store a set of $10$ vertices? How much space does it take to go over all pairs of nodes in a graph?
Another hint: How much space does it take to implement the following algorithm? (I replaced 10 with 3 to make it easier to follow)
Another hint: How much space does it take to implement the following algorithm? (I replaced 10 with 3 to make it easier to follow)
int algorithm(int n, int G[n][n]) {
int x, y, flag;
int v1, v2, v3;
for (v1 = 0; v1 < n; v1++)
for (v2 = 0; v2 < n; v2++)
for (v3 = 0; v3 < n; v3++) {
flag = 0;
for (x = 0; x < n; x++)
for (y = 0; y < n; y++)
if ((x != v1) && (x != v2) && (x != v3) &&
(y != v1) && (y != v2) && (y != v3))
flag |= G[x][y];
if (flag == 0)
return 1;
}
return 0;
}Code Snippets
int algorithm(int n, int G[n][n]) {
int x, y, flag;
int v1, v2, v3;
for (v1 = 0; v1 < n; v1++)
for (v2 = 0; v2 < n; v2++)
for (v3 = 0; v3 < n; v3++) {
flag = 0;
for (x = 0; x < n; x++)
for (y = 0; y < n; y++)
if ((x != v1) && (x != v2) && (x != v3) &&
(y != v1) && (y != v2) && (y != v3))
flag |= G[x][y];
if (flag == 0)
return 1;
}
return 0;
}Context
StackExchange Computer Science Q#9075, answer score: 5
Revisions (0)
No revisions yet.