Questions tagged [time-complexity]

The amount of time resources (number of atomic operations or machine steps) required to solve a problem expressed in terms of input size. If your question concerns algorithm analysis, use the [runtime-analysis] tag instead. If your question concerns whether or not a computation will ever finish, use the [computability] tag instead. Time-complexity is perhaps the most important sub-topic of complexity theory.

The amount of time resources (number of atomic operations or machine steps) required to solve a problem expressed in terms of input size. If your question concerns algorithm analysis, use the tag instead. If your question concerns whether or not a computation will ever finish, use the tag instead. Time-complexity is perhaps the most important sub-topic of .

2614 questions
27
votes
4 answers

Which Grows Faster: Factorial or Double Exponentiation

Which of the functions among $2^{3^n}$ or $n!$ grows faster? I know that $n^n$ grows faster than $n!$ and $n!$ grows faster than $c^n$ where $c$ is a constant, but what is it in my case?
Turing101
  • 1,200
  • 2
  • 14
  • 32
8
votes
1 answer

Why is log(n) a space-constructible function?

According to "Constructible function", Wikipedia: In complexity theory, a time-constructible function is a function f from natural numbers to natural numbers with the property that f(n) can be constructed from n by a Turing machine in the time of…
Maxim
  • 221
  • 1
  • 9
7
votes
0 answers

Non-deterministic time hierarchy theorem: universal TM overhead

I am currently reading the book of Arora and Barak on computational complexity. In the third chapter (p69-70), two classic theorems regarding time complexity hierarchies are introduced: $\left[f(n)\log(f(n)) = \mathcal{o}(g(n))\right] \Rightarrow…
JamesR
  • 71
  • 2
5
votes
1 answer

EXPTIME vs Super-polynomial time

It is proven by Time hierarchy theorem that EXPTIME-complete do not belong to P even if we do not know if NP belong to P. Before I read wiki, I found EXPTIME algorithm for solving 3-sat, the brute algorithm $O(2^n)$. Could I announced then, that…
Ilya Gazman
  • 909
  • 3
  • 15
  • 33
5
votes
2 answers

A hard $n$-fold integral

Consider the $n$-fold integral $$ J = \int_{\theta_1 \in I_1, \theta_2 \in I_2 \ldots, \theta_n \in I_n} d\theta_n\ldots d\theta_2 d\theta_1 $$ whose intervals are defined by $$ \begin{align} I_1 = [0,1] \\ I_i = [\max(c_i,\theta_{i-1}),1] , 2\leq…
PKG
  • 1,489
  • 10
  • 15
4
votes
3 answers

What are some problems in $\mathrm{P}$ with time complexity of high-degree polynomial?

What are some problems that are in $\mathrm{P}$ but the best known algorithm has a high-degree polynomial ($\ge 3$) time complexity?
4
votes
1 answer

Time complexity of arithmetic operations

I want to calculate the time complexity of the listed algorithms, please correct if I'm doing something wrong: The question is, do some operations like multiplying, dividing, or plus really affect on time complexity ? // Time complexity is O(log n) …
Michael
  • 41
  • 1
  • 3
4
votes
2 answers

Attempt to write a function with cubed log runtime complexity $O(\log^3 n)$

I'm learning Data Structures and Algorithms now, I have a practical question that asked to write a function with O(log3n), which means log(n)*log(n)*log(n). public void run(int n) { for (int i = 1; i < n; i *= 2) { for (int j = 1; j < n;…
Timeless
  • 785
  • 1
  • 8
  • 16
4
votes
1 answer

What are elementary operations in time complexity definition?

Wikipedia gives us the following defintion of time complexity: "In computer science, the time complexity is the computational complexity that describes the amount of time it takes to run an algorithm. Time complexity is commonly estimated by…
3
votes
2 answers

What is the correct time complexity of the following code

I was wondering what is the correct time complexity expressed in terms of big O on this type of loop: for(i=1;i<=n;i++) for(int j=1;j*i<=n;j++) // O(1) code here The inner loops will make $n + \frac{n}{2} + \frac{n}{3} + \dots +…
someone12321
  • 1,428
  • 13
  • 24
3
votes
1 answer

"Fuzzy" Chinese Remainder Theorem

I have some "fuzzy" congruences like these: \begin{align} \\ x&\equiv a_1 \mod 3 \text{ with } a_1 \in \{0,1\},\\ x&\equiv a_2\mod 5 \text{ with } a_2 \in \{2,3,4\},\\x&\equiv a_3 \mod 7 \text{ with } a_3 \in \{5,6\}\\ \end{align} These example…
CRTFan123
  • 71
  • 1
3
votes
1 answer

Justify the following running time

The book "Cracking the Coding Interview , 6th ed." describes the following method to sum the values of all nodes in a balanced binary search tree, and also claims that this method runs in O(n) time. int sum(Node node) { if (node == null) { …
Cow Pow Pow
  • 149
  • 3
  • 6
3
votes
1 answer

If O(f) = O(g), why also Θ(f) = Θ(g)?

How we can prove that if $O(f(x))=O(g(x))$ then $Θ(f(x))=Θ(g(x))$?
Nick James
  • 33
  • 2
3
votes
2 answers

Contradiction between best-case running time of insertion sort and $n\log n$ lower bound?

If the best case for Insertion sort & bubble sort is $O(n)$ then how is lower bound for any comparison sort is $\Omega(n\log n)$? I mean, $O(n)$ is obviously smaller than $\Omega(nlogn)$. What am I missing here?
3
votes
2 answers

Exponential time algorithms

Wiki define Polynomial time as fallow: An algorithm is said to be of polynomial time if its running time is upper bounded by a polynomial expression in the size of the input for the algorithm, i.e., $T(n) = O(n^k)$ for some constant $k$ I…
Ilya Gazman
  • 909
  • 3
  • 15
  • 33
1
2 3
10 11