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.

3148 questions
127
votes
7 answers

Is there a function that grows faster than exponentially but slower than a factorial?

In big-O notation the complexity class $O(2^n)$ is named "exponential". The complexity class $O(n!)$ is named "factorial". I believe that $f(n) = O(2^n)$ and $g(n) = O(n!)$ means that $\dfrac{f(n)}{g(n)}$ goes to zero in the limit as $n$ goes to…
Robert L. Read
  • 1,177
  • 2
  • 7
  • 10
95
votes
3 answers

Complexity class of comparison of power towers

Consider the following decision problem: given two lists of positive integers $a_1, a_2, \dots, a_n$ and $b_1, b_2, \dots, b_m$ the task is to decide if $a_1^{a_2^{\cdot^{\cdot^{\cdot^{a_n}}}}} < b_1^{b_2^{\cdot^{\cdot^{\cdot^{b_m}}}}}$. Is this…
61
votes
3 answers

Is "A New Kind of Science" a new kind of science?

A couple of years ago I was reading "New Kind of Science" (NKS) by S. Wolfram, and it presented lot of interesting ideas for a young Physics undergraduate. Now that I am studying Mathematics however, I realise that many ideas of NKS seem to be not…
45
votes
3 answers

What is the $3$-SAT problem?

In the hopes of improving my knowledge on the question, could someone outline the inputs and outputs for the 3-SAT problem? It would also be helpful if you could express how this problem differs in structure to SAT, 2-SAT or 4-SAT problems.
nubela
  • 801
  • 3
  • 10
  • 9
45
votes
22 answers

What does Big O actually tell you?

Two days ago I felt very uncomfortable with Big O notation. I've already asked two questions: Why to calculate "Big O" if we can just calculate number of steps? The main idea behind Big O notation And now almost everything has become clear. But…
40
votes
1 answer

$e^{e^{e^{79}}}$ and ultrafinitism

I was reading the following article on Ultrafinitism, and it mentions that one of the reasons ultrafinitists believe that N is not infinite is because the floor of $e^{e^{e^{79}}}$ is not computable. I was wondering if that's the case because of…
40
votes
4 answers

What is the *middle* digit of $3^{100000}$?

The decimal representation of $3^{100000}$ has $47713$ digits. What is the $23857^{th}$ digit - i.e. the one in the $10^{23856}$'s place? There are lots of questions on this site asking for the last digit of various large exponents, which are well…
37
votes
3 answers

Computational complexity of least square regression operation

In a least square regression algorithm, I have to do the following operations to compute regression coefficients: Matrix multiplication, complexity: $O(C^2N)$ Matrix inversion, complexity: $O(C^3)$ Matrix multiplication, complexity:…
Andree
  • 473
  • 1
  • 4
  • 6
35
votes
1 answer

How long can proofs be?

Let $$f(n) = \max\{\text{length of shortest proof of }\varphi \mid \varphi \text{ is a provable ZFC sentence of length } \leq n\}$$ How fast does $f$ grow? Is it polynomial, exponential, more than exponential, etc.?
user623070
35
votes
1 answer

Can some proof that $\det(A) \ne 0$ be checked faster than matrix multiplication?

We can compute a determinant of an $n \times n$ matrix in $O(n^3)$ operations in several ways, for example by LU decomposition. It's also known (see, e.g., Wikipedia) that if we can multiply two $n \times n$ matrices in $M(n)$ steps, then we can…
Misha Lavrov
  • 113,596
  • 10
  • 105
  • 192
34
votes
3 answers

Is factoring polynomials as hard as factoring integers?

There seems to be a consensus that factorization of integers is hard (in some precise computational sense.) Is it known whether polynomial factorization is computationally easy or hard? One thing I originally thought was that if we could factor…
Chris Brooks
  • 6,967
  • 3
  • 38
  • 61
26
votes
2 answers

What is the time complexity of Euclid's Algorithm (Upper bound,Lower Bound and Average)?

I looked it up online in many sites but none give a clear answer. They all give a lot of complicated mathematical stuff which is not only hard for me to grasp but also irrelevant as I simply want to know what is the upper bound (worst case…
Ivy Mike
  • 1,079
  • 4
  • 11
  • 18
21
votes
3 answers

Is there an easy way to find the sign of the determinant of an orthogonal matrix?

I just learned that if a matrix is orthogonal, its determinant can only be valued 1 or -1. Now, if I were presented with a large matrix where it would take a lot of effort to calculate its determinant, but I know it's orthogonal, is there a simpler…
20
votes
3 answers

Complexity of computing $ABx$ depends on the order of multiplication

To calculate $y = ABx$ where $A$ and $B$ are two $N\times N$ matrices and $x$ is an vector in $N$-dimensional space. there are two methods. One is to first calculate $z=Bx$, and then $y = Az$. This way takes roughly $2N^2$ multiplications. The other…
Nan
  • 407
  • 3
  • 13
19
votes
2 answers

What is the complexity of succinct (binary) Nurikabe?

Nurikabe is a constraint-based grid-filling puzzle, loosely similar to Minesweeper/Nonograms; numbers are placed on a grid to be filled with on/off values for each cell, with each number indicating a region of connected 'on' cells of that size, and…
1
2 3
99 100