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

Deterministic version of #P

#P is the complexity class concerned with counting the number of accepting paths of a non-deterministic Turing machine in polynomial time. Is there a deterministic equivalent to this complexity class?
Ben Crossley
  • 2,544
0
votes
0 answers

Computing condition number of a polynomial root finding probelm

Trefethen & Bau ("numerical linear algebra"; 1997) compute the condition number of polynomial root finding for $f(x) = (x-1)^2$ to be $k=\infty$ because the Jacobian does not exist. I want to know and understand the derivation of that result,…
abenol
  • 51
0
votes
0 answers

The computational complexity of lagrange multiplier(fmincon) in matlab

There is a function in Matlab called "fmincon()". Currently, I need to solve a lagrange multiplier problem which can be solved by fmincon() function. However, the number of constrain is quite high and the constrains are nonlinear. The problem looks…
0
votes
1 answer

Prove $T(n) = 2T(n-1) \in \Theta(2^n)$

Not sure how to prove this since there's no cost associated with each recursion.
0
votes
0 answers

Complexity limitations for randomness

I’m unsure if this is a stupid question, but: In general, is guessing a correct value faster when done randomly, or done incrementally from some basic seed/sequence? For example if I have [1,....,1Billion] and the number I’m guessing at 1B - 1,…
0
votes
0 answers

number of multiplications and additions

I would like to count the number of multiplications and addition in Cholesky Decomposition. Assume that I have Hermitian positive definite matrix. First, I will calculate all the entries in the lower triangular matrix, L using the Cholesky method.…
0
votes
1 answer

how to calculate running time of algorithm for this simple modulus operation?

With "n" being any positive integer, how many times the statement of while loop will be run, related to "n" please? while(n%2 == 0) n=n/2
0
votes
0 answers

Runtime Complexity of Recursive Sequence

I am given $T(n)=2T(n-1)+5^n$, and asked to find the runtime complexity. If there were no $5^n$ term, then the $T(n)$ would clearly be linear, $O(n)$. However, does the $5^n$ term make the complexity of this function $O(5^n)$?
0
votes
1 answer

Time complexity of multiplication of numbers of different size

I want to calculate the complexity of multiplying an a-bit number by a b-bit number. Intuitively, this would have complexity $O(ab)$ but I do not know how to show that this is true. I am also interested in the analogous complexities of division and…
Robert S
  • 1,144
0
votes
1 answer

Verifying reasoning: $2^{(10\log n + n/2)} = \mathcal{O}( 2^n)$

As the title states, why is $$2^{(10\log n + n/2)} = \mathcal{O}( 2^n)$$ The reason given via the solutions is, where $f_2(x) = 2^n$ and $f_3(x)=2^{(10logn + n/2)}$, If $c$ is any constant and $g(x)$ is a function, then $2^{cg(x)}$ =…
user52207
  • 95
  • 3
0
votes
1 answer

Time complexity for computing sum of first $n$ squares

I'm trying to compute time complexity for computing sum of first $\mathbf{n}$ squares. Actually, this is a problem from the textbook (A course in number theory and cryptography). The question is to compute time complexity for LHS and RHS of the…
0
votes
1 answer

Disproving Big-oh

How would you disprove the following: $ \exists k \in \mathbb{N}, n^n \in O(n^k) $. I am aware that I have to pick a value for $n \in \mathbb{N} $ that will give us $n^n > c*n^k$ but I can't seem to figure out how to pick such a value when c and k…
0
votes
2 answers

MAX-CUT to integer programming

I'm trying to understand MAX-CUT to IP, but I can't find the steps between them. So we have a MAX CUT problem and then you can turn it into this problem MAXCUT: $maximize_{x}$ $\frac{1}{4} \sum_{i=1}^{n} \sum_{j=1}^{n} w_{ij} (1-x_{i}x_{j})$ s.t.…
simplicity
  • 3,694
0
votes
3 answers

Determine whether $x^3$ is $O(g(x))$ for certain functions $g(x)$.

a) $g(x) = x^2$ b) $g(x) = x^3$ c) $g(x) = x^2 + x^3$ d) $g(x) = x^2 + x^4$ e) $g(x) = 3^x$ f) $g(x) = (x^3)/2$ Do you guys have any ideas? Thanks!
0
votes
2 answers

How to prove that $n^{n-2} = O(2^{n^2})$

I'm struggling to show that : $n^{n-2} = O(2^{n^2})$ . I know the definition of big O but I don't know any method to show this. Could you please help me giving a few methods?
Marine Galantin
  • 2,956
  • 1
  • 16
  • 33