Asymptotic complexity is an approximation of the edge case performance of an algorithm used to determine best and worst case scenarios.
Questions tagged [asymptotic-complexity]
796 questions
4
votes
3 answers
What functions are included in Big-O Notation?
I am learning about Big-O Notation and working on an assignment I am stuck on. Basically, I have been given different functions, and have to write the Big(O) for them. I think my confusion lies on what functions can be included in Big-O. I…

user8584662
- 59
- 4
4
votes
1 answer
Asymptotic complexity of slicing/merging blobs
I want to work heavily with JavaScript blobs. But I'm not sure about performance of some operations. So in this simple example...
let n = 10; // not a constant :-)
let blob = e.dataTransfer.files[0]; // some file from user...
let blob1 =…

Matěj Pokorný
- 16,977
- 5
- 39
- 48
4
votes
2 answers
Check if prime big-o
My original function to determine if a number was prime was:
bool is_prime(int x) {
for (int y = 2; y < x; ++y) {
if (x % y == 0) {
return false;
}
}
return true;
}
This ran with a complexity of O(x) as you…
user8371266
4
votes
1 answer
What is the time complexity of A* search
I'm new to stack overflow, but I'm here because I've searched everywhere and can't seem to find much info on the time complexity of A*, besides off the wiki. I would also like to compare it to Dijkstra's algorithm and see how adding a heuristic in…

Brandon Kynoch
- 150
- 1
- 1
- 7
4
votes
1 answer
Analyzing an algorithm with recurrence T(n) = T(n - 1) + T(n - 2) + c?
I know that this type of equations can be solved by many methods, but I want to use to use recurrence tree method to solve the equation.Can anyone show me how it is done by recurrence tree method?

Natsu
- 91
- 5
4
votes
1 answer
Which grows faster 2^(2^n) or n^(2n)
I am quite sure that the former function grows faster. But when I plotted it on Wolfram alpha, the latter seemed to dominate.
In general, if I want to compare f(n) and g(n), can an analysis of log(f(n)) and log(g(n)) be used for analysis of the…

pmuntima
- 640
- 5
- 13
4
votes
2 answers
When do we have to consider the constants in running time
Suppose I have two algorithms A() and B() such that algorithm A() takes exactly O(3n^2) while algorithm B() takes O(n^2). Although both algorithms run in quadratic time, can we say algorithm B runs faster than?
I understand that we ignore constants…

Kristofer
- 1,457
- 2
- 19
- 27
4
votes
2 answers
Big O class for (1/2)^n
Which Big O class would the function (1/2)^n fall into?
On a purely mathematical basis, it seems like we would have to put it into O(1) because 1/2^n approaches 0 for any sufficiently large n.
However, when it comes to asymptotic analysis and Big O,…

zzu
- 258
- 1
- 11
4
votes
4 answers
Fundamentals and maths required for algorithms
I have been working on RTOS and Linux driver development for quite some time. Now I am interviewing at semiconductor companies and failing to answer questions about algorithms on strings, and time and space complexity. I have not studied discrete…

jammulak
- 65
- 4
4
votes
1 answer
Function which is Big O(1) but not Ω(1)
Can some help me with a function which is Big O(1) but not Ω(1) and the other way around? Some explanation would greatly help.

rda3mon
- 1,709
- 4
- 25
- 37
4
votes
2 answers
Which Big-O grows faster asymptotically
I have gotten into an argument/debate recently and I am trying to get a clear verdict of the correct solution.
It is well known that n! grows very quickly, but exactly how quickly, enough to "hide" all additional constants that might be added to it?…

Idos
- 15,053
- 14
- 60
- 75
4
votes
3 answers
How to solve for this recurrence T(n) = T(n − 1) + lg(1 + 1/n), T(1) = 1?
I got stuck in this recurrence:
T(n) = T(n − 1) + lg(1 + 1/n), T(1) = 1?
for a while and it seems the master method cannot be applied on this one.

Bee
- 55
- 4
4
votes
4 answers
Why do my binary heap insertions behave this way in practice?
I implemented in C++ an array based binary heap and a pointer based binary heap. I run a small experiment where for varying input sizes n, I did n insertions. The elements are of type int32_t and each one of them is picked uniformly at random (with…

jsguy
- 2,069
- 1
- 25
- 36
4
votes
4 answers
How can an algorithm that is O(n) also be O(n^2), O(n^1000000), O(2^n)?
So the answer to this question What is the difference between Θ(n) and O(n)?
states that "Basically when we say an algorithm is of O(n), it's also O(n2), O(n1000000), O(2n), ... but a Θ(n) algorithm is not Θ(n2)."
I understand Big O to represent…

Yadrif
- 169
- 2
- 11