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
4
votes
1 answer

What is the complexity of $\Theta((n^3)/(\log(n))^4)$ ? Or $\Theta(n \cdot (\log(n))^3)$?

What is the complexity of $\Theta\big(\frac{n^3}{\\(log(n))^4}\big)$ ? Or $\Theta\big(n \cdot (\log(n))^3\big)$? Is the first one equal to $\Theta(n^3)$?
Alex
  • 235
4
votes
3 answers

$NP$ problems not known to be in $P$ and not known to be $NP$-complete

I've read that solving Pell's equation is neither known to be in $P$ nor known to be $NP$-complete. What are other natural and important examples of such problems?
Bartek
  • 6,265
4
votes
1 answer

Complexity of matrix multiplication with different size

I have three matrices $A, ~B, \text{and} ~C$ which are of size $M \times N, ~ N \times P, ~\text{and}~ P \times M $, respectively. What is the computational complexity of the multiplication $A\times B \times C$?
Hasti
  • 61
4
votes
1 answer

Time-complexity measures

According to Wikipedia, there are two common measures of time-complexity of algorithms: the more common worst-case complexity and the less common average-case complexity. Question 1 Assume that average-case complexity gives the expected value of run…
4
votes
1 answer

How do we distinguish NP-complete problems from other NP problems?

I just learned that when we have a polynomial algorithm for NP-complete problems, it is possible to use that algorithm to solve all NP problems. So, the question is how we then distinguish non-NP-complete NP problems from NP-complete problems? It…
4
votes
3 answers

how do you prove that 3-SAT is NP-complete?

As it is, how do you prove that 3-SAT is NP-complete? I know what it means by NP-complete, so I do not need an explanation on that. What I want to know is how do you know that one problem, such as 3-SAT, is NP-complete without resorting to reduction…
user2346
  • 631
  • 2
  • 7
  • 14
4
votes
1 answer

NP-completeness of Ising model

In this paper: http://www.brown.edu/Research/Istrail_Lab/papers/p87-istrail.pdf It is claimed that calculating partition function of 3 dimensional ising model is NP-complete. But I have a question, is it saying that calculating partition function is…
user40780
  • 249
  • 1
  • 9
3
votes
1 answer

How to prove Big-Oh Equation e.g. $O({2}^{2n}) = O(2^n)$

I visit a course about complexity theory but I have some troubles to prove a Big-Oh equation like this: $O(2^{2n}) = O(2^n)$ $O(g(n))$ is a set of functions that fulfill following definition: The function $f(n)$ is an element of $O(g(n))$ if there…
Burak
  • 153
3
votes
2 answers

How to figure out the time complexity for an algorithm with dynamic input parameters?

I have an algorithm that depending on the length of the input array and its values could take more or less operations to complete, for example, for a set with some length it could take 10.000 operations and for a set with same length but some…
3
votes
1 answer

Ambiguity in computing straight-line complexity of multivariate polynomials

I was wondering: I'm desiring to compute the following polynomial, $X_1^2 + 2 X_1\cdot X_2 +X_2^2$ where $X_1,X_2$ are indeterminates. I can store intermediate results and use the binary operators of multiplication and addition on the…
seagaia
  • 33
3
votes
1 answer

Time complexity of combinatorics?

I have two questions: 1) How can I represent $\binom{n-1}{k-1}$ in Big $O$ notation. 2) Say $W = \binom{n-1}{k-1}$. Let us consider there are $W$ functions ($f$) to optimize a variable $X$ and say $f_1(X) = p_1$, $f_2(X)=p_2$. What is the time…
samarasa
  • 305
3
votes
2 answers

Find the smallest natural number not in a given set of integers

What is the computational complexity of this task? The goal is to compute the number $x=\min(\Bbb N\setminus A)$, where $A$ is the input list and the complexity parameter is $n=|A|$ (which is finite). This is a common problem when generating a…
3
votes
1 answer

Showing that #SAT is NP-hard

I need some hints to solve the following problem. (from Complexity and cryptography by Talbot and Welsh, chapter 3, exercise 3.6) Let #SAT be the function, mapping Boolean formulae in CNF to $\mathbb Z^+$ defined $\text{#SAT}(f) = |\{a \in \{0,…
Gigili
  • 5,503
  • 8
  • 41
  • 62
3
votes
1 answer

How to classify these subsets of order complexity?

Let: $$f(n) = n^{2\log_2(n)}$$ $$g(n) = (n\ln(n))^2$$ $$h(n) = 3n^4$$ $$t(n) = \begin{cases} f(n) &\quad\text{if $n$ is a prime number}\\ g(n) &\quad\text{otherwise} \\ \end{cases}$$ Given that $O(g) \subset O(h)$, I want to find…
lalaland
  • 345
  • 1
  • 9
3
votes
2 answers

COMPOSITE $\in$P if and only if PRIME $\in$ P

Let COMPOSITE be the following decision problem. COMPOSITE Input: an integer $n \geq 2$. Question: is n composite? Show that COMPOSITE $\in$P if and only if PRIME $\in$ P. I think I must take an algorithm for COMPOSITE. This gives…
Gigili
  • 5,503
  • 8
  • 41
  • 62
1
2
3
22 23