Questions tagged [asymptotic-complexity]

Asymptotic complexity is an approximation of the edge case performance of an algorithm used to determine best and worst case scenarios.

796 questions
0
votes
2 answers

Why using heuristics in an algorithm takes away asymptotic optimality?

I was reading about some geometric routing algorithms, there it says that when employing heuristics in a version of the main algorithm it may improve performance, but takes away asymptotic optimality. Why is that the case? Should we prefer…
0
votes
1 answer

Asymptotic proof examples

I came across two asymptotic function proofs. f(n) = O(g(n)) implies 2^f(n) = O(2^g(n)) Given: f(n) ≤ C1 g(n) So, 2^f(n) ≤ 2^C1 g(n) --(i) Now, 2^f(n) = O(2^g(n)) → 2^f(n) ≤ C2 2^g(n) --(ii) From,(i)…
Andrew
  • 71
  • 2
  • 5
0
votes
1 answer

What is the asymptotic running time for variance?

As you can see I'm still pretty new with all these run time analyses and want to make sure each step I'm calculating is right.. Also I hate writing in pseudocode form so I did this in Python instead.. here goes def mean(n): sum = 0 …
compski
  • 709
  • 3
  • 13
  • 28
0
votes
1 answer

Instruction execution of a C++ code

Hello I have an algorthm in C++ and I want to find the instructions executed. The code is below cin >> n; for(i=1;i<=n;i++) for (j = 1; j <= n; j ++) A[i][j] = 0; for(i=1;i<=n;i++) A[i][i] = 1; now, after my calculation, I got this…
helpdesk
  • 1,984
  • 6
  • 32
  • 50
0
votes
2 answers

Asymptotic lower bound of O(n^2)

Are there problems in P that have a proven asymptotic lower bound of O(n^2) or higher? (n is the number of bits a problem instance can be represented by). This is not a homework question, just curiosity.
Konstantin Weitz
  • 6,180
  • 8
  • 26
  • 43
0
votes
2 answers

Proving log(n!) is in Ω(n log(n))

The total cost of our operations are: Σ(i=1 to n) log(i). Prove that this sum is Ω(n log(n)). I'm a little bit stuck on how to go about proving this. I realize the summation comes out to be log(n!), since log(1) + log(2) + log(3) = log(3!) (and so…
user677786
  • 455
  • 1
  • 6
  • 13
0
votes
1 answer

Is this generalization of Big-Theta notation correct?

Say you have an algorithm that completes in a polynomial number of steps for the input of size n, like, for example, P(n)=2n^2+4n+3. The asymptotic tight bound for this algorithm Θ(n^2). Is it true to say that the Big-Theta notation for any…
0
votes
2 answers

Studying for my final: Asymptotic notation

I am currently studying for my final in algorithms. This is not a homework problem and comes from an old final exam. Show that f(n) = 4logn + log log n is big theta of logn. It is obvious that log log n is considerably smaller than log n and thus…
SamuelN
  • 1,341
  • 1
  • 10
  • 19
0
votes
2 answers

Is it true or false that, for any algorithm, its average-case performance is always better than the worst-case performance asymptotically

I'd like to think this is true, but I'm not too confident in that answer. Is there an algorithm that has an equal running time in the both the average and worst case. I'm not sure if the answer would be true then.
blutuu
  • 191
  • 2
  • 12
0
votes
2 answers

Different upper bounds and lower bounds of same algorithm

So I just started learning about Asymptotic bounds for an algorithm Question: What can we say about theta of a function if for the algorithm we find different lower and upper bounds?? (say omega(n) and O(n^2)). Or rather what can we say about…
0
votes
2 answers

Algorithm analysis (big-O) for algorithm

I'm trying to help a friend analyze the complexity of his algorithm but my understanding of Big-O notation is quite limited. The code goes like this: int SAMPLES = 2000; int K_SAMPLES = 5000; int i = 0; // initial index position while (i <…
karlphillip
  • 92,053
  • 36
  • 243
  • 426
0
votes
2 answers

Is (log n)^k = O(n^1/2)? For k greater or equal to 0

In big-O notation is O((log n)^k) = O(log n), where k is some constant right? So what's happening with the (log n)^k when k>=0?
User1911
  • 197
  • 1
  • 13
0
votes
3 answers

time complexity for the following

int i=1,s=1; while(s<=n) { i++; s=s+i; } time complexity for this is O(root(n)). I do not understood it how. since the series is going like 1+2+...+k . please help.
SeasonalShot
  • 2,357
  • 3
  • 31
  • 49
0
votes
3 answers

Computational complexity of for loops-Contradicting with myself

I have a contradiction by analyzing the running time of a program. For example, consider the following piece of code: for(int i=0;i
user2110714
0
votes
1 answer

Number of times a code is executed

I have a piece of code that says: for i = 4,16, . . . , n I am trying to find an upper bound in terms of big oh notation for the number of times the statement gets executed. I believe here it goes like 4,42,43 ... and so on. Since it grows…
yrazlik
  • 10,411
  • 33
  • 99
  • 165