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
-1
votes
3 answers

What does 'log' represent in asymptotic notation?

I understand the principles of asymptotic notation, and I get what it means when something is O(1) or O(n2) for example. But what does O(log n) mean? or O(n log n) for example?
Dollarslice
  • 9,917
  • 22
  • 59
  • 87
-1
votes
2 answers

Object oriented programming and asymptotic run-time

Are some ways of structuring a class hierarchy more efficient than others? Is there a way to measure this? How do design patterns factor in to computational complexity? Am I just thinking about this wrong? Just curious.
dumpstercake
  • 127
  • 1
  • 1
  • 3
-1
votes
1 answer

Asymptotic time complexity O(sqrt(n)log(n)n)

for(int i=1; i*i <= n; i = i+1) { for(int j = n; j >= 1; j/4) { for(int k = 1; k <= j; k=k+1) { f(); } } } Why is the asymptotic complexity of this function O(n^{3/2})? I think, it should be O(sqrt(n)log(n)n). Is this…
pramort
  • 35
  • 4
-1
votes
2 answers

Get the Asymptotic Notation of The Run time

I have the runtime below: T(n) = (1- (1/2^n)) ((n+1)/2) I know its upperbound can be something like : O(2^n) But I couldn't find its lowerbound or omega. Is it possible that an algorithm has no lower bound? What about theta ? little oh and little…
-1
votes
1 answer

What is the asymptotic complexity of T(n) = 2T(n/3) +n/ (logn) ^2?

Master theorem fails so tried recursion tree, variable change, repeating method, etc etc. I can’t handle the “sum from i = 0 to log3(n) of (2/3)^i * n/((log(n/3^i))^2 “ that occurs: Used logarithmic properties to expand, but still a dead end for…
-1
votes
1 answer

Why can the third case of master theorem not be applied here T(n)=2T(n/2)+nlgn

Why is nlgn polynomially larger than n when: "Polynomially larger" means that the ratio of the functions falls between two polynomials, asymptotically Here n^0.1 < log n < n^0.4 , so nlgn should be polynomially larger than n and hence we should be…
-1
votes
2 answers

What is the runtime for this code

def mystery11(n): if n < 1: return n def mystery12(n): i = 1 while i < n: i *= 2 return i return mystery11(n/2) + mystery11(n/2) + mystery12(n-2) I have a question about the code above. I completely understand that without…
-1
votes
1 answer

Asymptotic growth (Big o notation)

What I am trying to do is to sort the following functions: n, n^3, nlogn, n/logn, n/log^2n, sqrt(n), sqrt(n^3) in increasing order of asymptotic growth. What I did is, n/logn, n/log^2n, sqrt(n), n, sqrt(n^3), nlogn, n^3. 1) Is my answer correct? 2)…
seung
  • 53
  • 1
  • 7
-1
votes
1 answer

How to find the asymptotic complexity of 3Sum.java

how do you get the time complexity of the functions count and printall in ThreeSum.java? public static void printAll(int[] a) { int n = a.length; for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { for (int k =…
unnieyah
  • 3
  • 3
-1
votes
2 answers

How to solve the recurrence A(n) = A(n-1) + n*log(n)?

Given the recurrence: A(n) = A(n-1) + n*log(n). How do I find the time complexity of A(n)?
awareeye
  • 3,051
  • 3
  • 22
  • 22
-1
votes
1 answer

How to get asymptotic running time?

I do not know how to get exact Asymptotic Complexity as following question asks me to solve. Here is Question: Everything I learned from class is that, if there exists "for loop" that runs N times, or recursively call "recursive method" N times,…
-1
votes
1 answer

Finding lower bound on time complexity of finding k pairs

We are given n bolts and n nuts of different sizes, where each bolt exactly matches one nut. Our goal is to find the matching nut for each bolt. The nuts and bolts are too similar to compare directly; however, we can test whether any nut is too big,…
J Doe
  • 1
  • 1
-1
votes
1 answer

Find tightest big-O

I'm trying to learn and understand how to find tightest big O notation. Here I need to find tightest big-O notation for these algorithms, and I did the calculating for the running time. Now I need to prove or find the tightest big-O notation but…
stephan
  • 37
  • 8
-1
votes
1 answer

Does for all k, n^k is O(2^n)?

Is it true that for all k, n^k is O(2^n)? What I actually want to know whether this upper bound is correct. Like we can say n^2 is O(n^3) since it's true that n^2 < c * n^3, where c is a constant. SO similarly can I say that n^k < c * 2^n, for all…
russell
  • 3,668
  • 9
  • 43
  • 56
-1
votes
5 answers

What is difference between different asymptotic notations?

I am really very confused in asymptotic notations. As far as I know, Big-O notation is for worst cast, omega is for best case and theta is for average case. However, I have always seen Big O being used everywhere, even for best case. For e.g. in the…