Given a Boolean formula over $n$ variables in CNF and a partial assignment to it, all the algorithms I can think of to evaluate the assignment run in time $\Theta(n^2)$. Is it possible to do it in $O(n)$? I'd say no, because otherwise SAT would be in NTIME(n) and we know that P is different from NTIME(n), but maybe this is a misleading argument.
1 Answers
No. You can't even do it in $O(n^2)$ time, if $n$ is the number of variables. The formula might be much longer than $\Theta(n^2)$ (it might have many more clauses than that), and obviously any correct algorithm will have to read the entire formula (at least in the worst case), so the running time of any correct algorithm has to be at least as large as the length of the formula. The length of the formula can be as big as $2^n$, so any algorithm to evaluate the formula under a particular assignment might take as long as $O(2^n)$ time, assuming you try to measure its running time only in terms of the number of variables.
In complexity theory, we normally don't measure the running time of algorithms in that way. Typically, we measure the running time as a function of the length of the input, not the number of variables.
- 167,959
- 22
- 232
- 500