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
2 answers

solving recurrence examples of form T(n-i) + f(n)

I've been working on a problem set for a bit now and I seem to have gotten the master method down for recurrence examples. However, I find myself having difficulties with other methods (recurrence trees, substitution). here is the question I am…
wenincode
  • 376
  • 5
  • 10
  • 20
-1
votes
2 answers

Value of constants in Big Theta notation

In Big Theta notation, do the constants c1 and c2 differ for each value of n?. Definition: Theta(g(n)) = {f(n): there exist c1 >= 0, c2 > 0 and n0 > 0 such that for all n >= n0, 0 <= c1, g(n) <= f(n) <= c2 *…
sparth
  • 137
  • 4
-1
votes
1 answer

Asymptotic runtimes of InsertionSort and FingerTreeSort

I've searched high and low in my book aswell as several sites on the internet, but I'm just not entirely sure about my answers. I need to give asymptotic runtimes of InsertionSort and FingerTreeSort (based on RB-Trees), in regards to the number of…
-2
votes
1 answer

Give both an exact and asymptotic answer for the pseudo code below

for i <--- 1 step i <--- 2* i while i< n do for j <--- 1 step j <---2* j while j
Ice
  • 3
  • 4
-2
votes
2 answers

Time needed for comparisons to return vs just returning True or False

I'm having trouble understanding why one version of my code takes twice as long as the other. They both person the same function which is to return True if the number passed in is a palindrome, otherwise return False. The first version averages…
BigBear
  • 188
  • 10
-2
votes
1 answer

Complexity analysis of while(key <= N*N) loop using Big-Oh

I'm kind of confused to conclude the Big-O notation for this while loop, where N is the input size: int array[0][(N-1)/2] = 1; int key = 2,k,l; i = 0; int j = (N-1)/2; while(key <= N*N) { if(i <= 0) k = N-1; else k = i-1; …
-2
votes
2 answers

Asymptotic Complexity comparison

Can anybody explain which one of them has highest asymptotic complexity and why, 10000000n vs 1.000001^n vs n^2
Cody
  • 9
  • 1
-2
votes
2 answers

Prove O(n) is not a subset of O(n log n)

I saw a proof for O(2n) is same as O(n) in this post => Which algorithm is faster O(N) or O(2N)? Which means O(n) is same as O(4n). Can someone show me how O(n) is not a subset of O(n log n)? Because, if n = 16 and base = 2, O(n log n) will be O(n…
-2
votes
1 answer

Asymptotic running time of loop

function func5(n) s = 0; for i = 1 to 3n^2 do for j = 1 to floor(2n^3/i) do s=s + i − j; return(s); What is the asymptotic running time of the above algorithms in theta notation?
-2
votes
1 answer

How to make a tight O analysis of the algorithm?

Make a tight big-O analysis of following code. I'm getting confused due to this array. void main( ) { int m,n,i,j,a[ ], b[ ], c[ ]; printf(''Enter value of m and n''); scanf(''%d %d'',&m, &n); for (i = 0; i < n; i++) { …
-2
votes
1 answer

Dominating Term between 2^logn and n^(5/2)

lets say in order to compute Big-O of these two functions and take log both sides fx<=c.gx log(2^logn) + log(n^(5/2)) <= log(n^(5/2)) which is log n + log n <= log n it satisfies for equals if any one function taken out from left side log n = log n.…
Vishal Patwardhan
  • 317
  • 1
  • 4
  • 15
-2
votes
1 answer

Asymptotic Notations Clarification

1) Ο(f(n)) = { g(n) : there exists c > 0 and n0 such that f(n) ≤ c.g(n) for all n > n0. } 2) Ω(f(n)) ≥ { g(n) : there exists c > 0 and n0 such that g(n) ≤ c.f(n) for all n > n0. } 3) θ(f(n)) = { g(n) if and only if g(n) = Ο(f(n)) and g(n) = Ω(f(n))…
Nikunj Kakadiya
  • 2,689
  • 2
  • 20
  • 35
-2
votes
2 answers

Math - Relation of 2 algorithm

Two expression with A and B: A = 2^(3(log_3 n)) B = 6(n^2) As i need to indicate whether A is big-Oh, big-Omega, or big-theta of B, is that A=O(B)? how to solve this?
-2
votes
1 answer

How to find time complexities when varying the input size?

I'm wondering how you calculate the time complexities of a function when doubling the input sizes. I'm specifically referring to the famous Algorithms Design practice problems. Example Problem Questions Here The solutions: Solutions At first, it…
-2
votes
1 answer

Understanding asymptotic notation when given asymptotic performance, time and number of elements

2nd year computer science student here. In class we are covering asymptotic notation, sorting algorithms and such. I need some help understanding asymptotic notation and how the values relate to one another. I have been at it for a little while but…