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
1
vote
1 answer

What do log-equivalent and log-complete mean?

I'm reading the paper The Complexity of Satisfiability Problems by Thomas Schaefer(1978). In the paper, he mentions the phrases "log-equivalent" and "log-complete." Searching through the Google results does not seem to give me anything related to…
starflyer
  • 550
1
vote
1 answer

Given $L = L_1 \cap L_2$ where $L_1 \in NP$ and $L_2 \in coNP$, how do I express L as a symmetric difference of 2 sets in NP?

My ultimate goal is to show that $L \in PP$, but I need to figure out the title question first as an intermediary step. Any help is appreciated, thanks in advance.
1
vote
1 answer

On average, as a function of n, how many print statements are executed by the following algorithm?

On average, as a function of n, how many print statements are executed by the following algorithm? For i = 1 to n For j = i to n For k=1 to n print(i, j, k); a. n(n+1)/2 b. n^3 c. n^2 * ((n-1)/2) d. n^2 * ((n+1)/2) I find this problem…
Hyune
  • 101
1
vote
1 answer

$ f(n)=2\log(n)+\frac{n}{2} $. Find $g(n)$ so that $f(n)=O(n)$

$ f(n)=2\log(n)+\dfrac{n}{2} $. Find $g(n)$ so that $f(n)=O(n)$. $ T(n)=T(n-2)+1$, $T(1)=T(0)=1 $ Find $g(n)$ so that $T(n)=O(n)$. It's supposed to be two simple questions but I guess that I didn’t understand the book’s explanation. Help.
G-kan
  • 69
1
vote
1 answer

Prove that the subset sum problem with fixed size and number reusability is NP complete

I'm trying to solve the following problem: There are B (B is allowed to vary) lists of unspecified size containing integers. Pick a number from each list so that the sum of all the picks is exactly A. Prove that this problem is NP complete by…
1
vote
4 answers

$\mathcal{O}(n^n) > \mathcal{O}(n!) > \mathcal{O}(c^n) > \mathcal{O}(n^c) > \cdots $?

Is the following relationship correct $$\mathcal{O}(n^n) > \mathcal{O}(n!) > \mathcal{O}(c^n) > \mathcal{O}(n^c) > \mathcal{O}(n \cdot Log(n)) > \mathcal{O}( Log(n)) $$ Where $\mathcal{O}$ is big O notation and $c$ is some positive constant.
kaka
  • 1,896
1
vote
2 answers

Big-O notation of $n^2/2+n/2$

I'm just starting to use big-O notation and I just wanted to make sure I was on the right track. My algorithm is the following: $$\frac12n^2+\frac12n$$ I came up with $O(n^2)$ is that correct?
1
vote
1 answer

Proving Priority Queue Operations Are Omega(log n)

From a textbook on computational problems, there's a question I've been pondering... Q: If a priority queue has operations to add a value and show/remove the smallest value, show that for an implementation, which only accesses data by copying and…
1
vote
1 answer

Are there problems known to be not in $P$ but not known to be outside $NP$?

Although most experts believe that $NP$ is not equal to $P$, for a long time I believed that of the two directions of attacking the $P$ vs $NP$ problem trying to prove that $P = NP$ is the more fun one as it can be resolved by finding a clever…
Vincent
  • 10,614
0
votes
1 answer

NLogSpace and CoNLogSpace

Assume S1, S2∈ NLOGSPACE. Which of the following statements is true? • S1 \ S2 ∈ coNLOGSPACE • S1 Δ S2 ∈ NLOGSPACE where A\B is the set of members of A that are not members of B. And A Δ B is the set of members of A U B that are not members of A ∩ B
0
votes
2 answers

Time complexity, proof $\log(n + c) \in O(\log(n))$

I have to prove that for $a \in N, c > 0$ (constants), this statement holds: $\log_a(n + c) \in O(\log_a(n))$ So if I use the definition, the following should hold: $\log_a(n + c) \leq d\log_a(n) = \log_a (n^d), \forall n \geq n_0, d > 0$ I have to…
Smajl
  • 686
0
votes
1 answer

Basic Equation question

This is regarding algorith complexity, but that's not the point here. I saw this resolution: 4( n/1,3 )² = 4/1,69 x n² Could anyone clarify how is this equation is done? How can 4( n/1,3 )² equals to 4/1,69 x n² I tried to reproduce but failed…
0
votes
1 answer

Different Forms Of The Halting Problem - Recognizability

There are different versions of the Halting Problem: 1) $\{ P \mid\text{there exists $i$ such that $P$ halts on $i$} \}$, 2) $\{ (P,k) \mid \text{there are less than $k$ inputs that $P$ halts on} \}$, 3) $\{ (P,k) \mid \text{there are $k$ (or…
user137481
  • 2,605
0
votes
1 answer

Different Forms of the Halting Problem

The version of the Halting Problem I'm familiar with is: { (P, i) : P halts on input i } I've seen the following other versions mentioned: 1) { (P, i): there exists i such that P halts on i } 2) { (P, i): P halts on less that k inputs i } 3) {…
user137481
  • 2,605
0
votes
2 answers

Analysis of algorithm about complexity

$n$ is $O(\log n)^{\log n}$ ? This is true or false, Give the reasons behind that ? I dont get understand about that $O(\log n)^{\log n}$.