Questions tagged [computational-complexity]

Use for questions about the efficiency of a specific algorithm (the amount of resources, such as running time or memory, that it requires) or for questions about the efficiency of any algorithm solving a given problem.

Computational complexity is a part of theoretical computer science that answers questions about how efficient an algorithm is:

  • How much time (as a function of the size of the input) does the algorithm take to produce its output?
  • How much space (such as computer memory) does it require?
  • How much of some other resource does it consume? (For example, this can be the size of a logic circuit solving the problem, or the number of bits of randomness used by a probabilistic algorithm.)

We can similarly ask about the computational complexity of any algorithm that solves a given problem.

Often, very specific details of these answers (such as constant factors or additive terms) depend on specific details such as the computer you're using. To help deal with this, we often stick to determining the asymptotic complexity of an algorithm: see for more details.

A major problem in computational complexity is the P versus NP problem, which asks if a certain class of problems can be solved by an algorithm that runs in a number of steps that's a polynomial function of the input size.

3433 questions
0
votes
0 answers

What exactly is the definition of an evaluation oracle?

What is the definition of an evaluation oracle in complexity theory?
0
votes
0 answers

Does 'polynomial' (or 'exponential') running time for 3-SAT problem refer to the number of variables or the number of clauses?

This sounds like an incredibly stupid question but none of the relevant Wikipedia pages seem to answer it. So... if the runtime of an algorithm to solve 3SAT has running time $O(f(n))$ for some function $f$, what is $n$? If $n$ is the number of…
Vincent
  • 10,614
0
votes
1 answer

time complexity

Given n integers a1,a2..an and some integer S. To test whether there exists xi belongs to {0,1} such that: **S = Summation(xi*ai) [i=0 to n]** Test whether when using (x1,x2,..xn) := (0,0,..,0) in the above eqn, this would…
0
votes
1 answer

Worst Case Analysis

For the following algorithm, the function base() is to be considered the basic operation. The size of the input is given by n. Perform a worst-case analysis: for(i = 0; i < n; i++) for(j = 0; j <= n; j++) for(k = i; k <= i*i; k++) …
Xian
  • 89
0
votes
1 answer

Do the complete areas of various complexity classes have infinitely many problems?

Possible Duplicate: Complexity classes and number of problems I know that almost all of complexity classes that have some significance have infinite number of decision problems. Then what about complete area of these complexity classes? I know…
user2346
  • 631
  • 2
  • 7
  • 14
0
votes
1 answer

Can every problem in P be polynomially reduced to every other problem in P?

If A and B are in P and A can be polynomially reduced to B. Then can B be polynomially reduced to A? If yes then how? Another way to think about it. If A is NP-complete and B is in P and if A can be polynomially reduced to B then P=NP. it is…
0
votes
0 answers

NP-hardness of CIRCUIT-SAT

How to prove NP-hardness of CIRCUIT-SAT, without the use of other NP-complete problems but using Turing machines? And, if it is possible, I need a full proof, not a sketch.
yhn112
  • 1
0
votes
1 answer

size of first-order formulae to express a property

Let $FO-SIZE[s(n)]$ be the set of properties expressible by uniform sequences of first- order formulas, $\{\phi_{i}\}_{i\in \mathbb{Z^+}}$ , such that the $n$th formula has $O(s(n))$ symbols and expresses the property in question for structures…
user2346
  • 631
  • 2
  • 7
  • 14
0
votes
2 answers

Complexity classes and number of problems

Will every complexity class contain infinite number of problems? If they do not, do common complexity classes (e.g. P,NP,PSPACE,EXPTIME,EXPSPACE etc.) contain infinite number of problems?
user2346
  • 631
  • 2
  • 7
  • 14
0
votes
1 answer

Calculate difference in throughput between two computers when the time complexity is $2^n$

The time complexity for some algorithm is $T(n) = 2^n$ where n is the size of inputs. A particular computer takes t seconds to process n inputs. How many inputs can a computer that is 64 times as fast process during the same time t? How would an…
lawls
  • 461
  • 2
  • 7
0
votes
2 answers

Proof that **NP=P** implies **NP=NPC**

As the title says, I am not sure how the former implies the latter. Please someone sketch a few details. Many thanks
0
votes
1 answer

Why is $O(n^{km}+n^m)=O(n^{km})$?

I've seen this equation in one of my handouts $O(n^{km}+n^m)=O(n^{km})$, which doesn't seem obvious to me. This is what I got trying to work it out: $$\begin{align*}n^{km}+n^m &\leq C \cdot n^{km}\\ \frac{n^{km}+n^m}{n^{km}}&\leq C…
0
votes
2 answers

Complexity class P - is $k$ only natural numbers?

I think I have seen an algorithm that has $x^{1.5}$ as its complexity. However, according to Wikipedia, it states that the complexity class P is defined as $\bigcup_{k\in\mathbb{N}} \mbox{DTIME}(n^k)$. So does this mean that only natural numbers are…
user27515
  • 895
0
votes
0 answers

Can you decouple the Traveling Salesman Problem from the number of cities?

I am studying the euclidian version of the Travelling Sales Man problem: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin…
Maestro
  • 165
0
votes
1 answer

Big-O complexity of iterating over every substring

What is the Big-O complexity of iterating over every possible non-empty substring of a string of length $N$? The simple way to do the iteration over string $S$ is: for i in 1 .. N: for j in (i+1) .. N: S[i .. j] Clearly this is more…