The complexity class $\mathsf{UP}$ consists of those $\mathsf{NP}$-problems that can be decided by a polynomial time nondeterministic Turing machine which has at most one accepting computational path. That is, the solution, if any, is unique in this sense. It is thought highly unlikely that all $\mathsf{UP}$-problems are in $\mathsf{P}$, because by the Valiant-Vazirani Theorem this would imply the collapse $\mathsf{NP}=\mathsf{RP}$.

On the other hand, no $\mathsf{UP}$-problem is known to be $\mathsf{NP}$-complete, which suggests that the unique solution requirement still somehow makes them easier.

I am looking for examples, where the uniqueness assumption leads to a faster algorithm.

For example, looking at graph problems, can a maximum clique in a graph be found faster (though possibly still in exponential time), if we know that the graph has a unique maximum clique? How about unique $k$-colorability, unique Hamiltonian path, unique minimum dominating set etc.?

In general, we can define a unique-solution version of any $\mathsf{NP}$-complete problem, scaling them down to $\mathsf{UP}$. Is it known for any of them that adding the uniqueness assumption leads to a faster algorithm? (Allowing that it still remains exponential.)

  • 7
    $\begingroup$ Your first sentence gives the correct definition of UP, but the rest of your references to UP should really be to PromiseUP instead (including Valiant-Vazirani). Either way this is a very interesting question. Two examples: 1) Factoring is in UP, and has an algorithm faster than those known for NP-complete problems (but Factoring is also in coNP and even coUP, so it's not so clear that uniqueness is underlying the fast algorithm here.) 2) Sodoku, as traditionally defined, is in PromiseUP, yet I don't know of any approaches to Sudoku-solving that take advantage of the promised uniqueness. $\endgroup$ Commented Apr 13, 2014 at 2:49
  • 9
    $\begingroup$ The parity of the number of Hamiltonian paths can be found in time $1.618^n$ (arxiv.org/pdf/1301.7250.pdf), while the best known algorithm for the decision problem takes almost $2^n$ time. $\endgroup$ Commented Apr 13, 2014 at 4:06
  • 8
    $\begingroup$ Here's an example from quantum computing: Consider the search problem on n items. If you know there is exactly 1 marked item, you can find it with an exact quantum algorithm with $\Theta(\sqrt{n})$ queries. If you don't know the number of marked items, any exact quantum algorithm needs $n$ queries. $\endgroup$ Commented Apr 13, 2014 at 13:45

4 Answers 4


3-SAT may be one such problem. Currently the best upper bound for Unique 3-SAT is exponentially faster than for general 3-SAT. (The speedup is exponential, although the reduction in the exponent is tiny.) The record-holder for the unique case is this paper by Timon Hertli.

Hertli's algorithm builds upon the important PPSZ algorithm of Paturi, Pudlák, Saks, and Zane for $k$-SAT, which I believe is still the fastest for $k \geq 5$ (see also this encyclopedia article). The original analysis showed better bounds for Unique $k$-SAT than for general $k$-SAT when $k = 3, 4$; subsequently, however, Hertli showed in a different paper that you could get the same bounds for (a slightly tweaked) PPSZ algorithm, without assuming uniqueness. So, maybe uniqueness helps, and it can definitely simplify the analysis of some algorithms, but our understanding of the role of uniqueness for $k$-SAT is still growing.

There is evidence that Unique $k$-SAT is not too much easier than general $k$-SAT. The Strong Exponential Time Hypothesis (SETH) asserts there is no $\delta < 1$ such that $n$-variable $k$-SAT is solvable in $O^*(2^{\delta n})$ time for each constant $k \geq 3$. It was shown in a paper of Calabro, Impagliazzo, Kabanets, and Paturi that, if SETH holds, then the same statement is true for Unique $k$-SAT. Also, if general $k$-SAT requires exponential time, i.e. there is some $k \geq 3, \epsilon > 0$ such that general $k$-SAT cannot be solved in time $O^*(2^{\epsilon n})$, then the same must be true for Unique 3-SAT. See the paper for the most general statement.

(Note: the $O^*$ notation suppresses polynomial factors in the input length.)

  • 1
    $\begingroup$ "true for Unique 3-SAT" $\: \mapsto \:$ "true for Unique k-SAT" $\;\;\;\;$ $\endgroup$
    – user6973
    Commented Apr 13, 2014 at 18:56
  • $\begingroup$ Hi Ricky, I don't see a problem with what's written. The last assertion about Unique 3-SAT is found in the paper's abstract. $\endgroup$ Commented Apr 13, 2014 at 20:53
  • $\begingroup$ Ah, I see that different $k$s would need to be used for what I was saying,$\hspace{1.58 in}$ which would just make it confusing. $\;$ $\endgroup$
    – user6973
    Commented Apr 15, 2014 at 16:43

Shortest 2-Vertex disjoint path problem in undirected graphs recently solved (ICALP14) by A. Bjorklund and T. Husfeldt. But the deterministic solution is for the case of existence of a unique solution. In the case that there are more than one solution, they showed that the problem belongs to RP. As authors of the paper mentioned, it is not known if the problem is in P in general scenario.

  • 3
    $\begingroup$ Thank you, it is very interesting. The general case, where the solution is not unique, is also a nice example of a natural (or even practical) graph problem, which is now proved to be in RP, but not known to be in P. $\endgroup$ Commented May 1, 2014 at 20:14

Outside of complexity theory and the analysis of algorithms, the assumption that there can be only one solution forms the basis for some of the standard rules used to deduce the solution in Sudoku puzzles. These rules generally involve looking for ways in which parts of the puzzle might be able to have two or more solutions that don't interact with the rest of the puzzle. That can't happen in the actual solution, so if a pattern that threatens to cause this is found, then it must be broken, allowing the solver to deduce constraints on what the actual solution can look like. See http://www.brainbashers.com/sudokuuniquerectangles.asp for some examples of deduction rules based on uniqueness.


Mentioning another result by Björklund, if you are guaranteed that there is at most one Hamiltonian cycle in a graph, you can decide if a graph $G$ is Hamiltonian faster than you can in general.

The uniqeness assumption means that the parity of the number of Ham. paths is the same as deciding if the graph is Hamiltonian.

Björklund's method deterministically computes the parity of the number of Hamiltonian cycles in $O(1.619^n)$ while the best known randomized algorithm for Undirected Hamiltonicity runs in $O^*(1.657^n)$ , and the best deterministic algorithm for Directed Hamiltonicity (to the best of my knowledge) is still the 50 years old $O(n^22^n)$ dynamic programming algorithm by Bellman, Held and Karp.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.