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
1 answer

Recurrence relations and asymptotic complexity

I am trying to understand the recurrence relation of f(n) = n^cos n and g(n) = n. I am told that this relation has no asymptotic behavior related to Big O, little o, Big Omega, little omega, or Theta. Something about the oscillations of cos n? Can I…
user3339453
  • 57
  • 1
  • 7
0
votes
1 answer

Complexity of Operation That Isn't Performed

If I want to describe the time complexity of an operation that isn't performed in some program, how could I do this? For example, given the following trivial function: def trivial(): return How could I describe the upper bound on the time…
0
votes
2 answers

Quicksort vs Median asymptotic behavior

Quicksort and Median use the same method (Divide and concuer), why is it then that they have different asymptotic behavior? Is it that quicksort may not use the proper pivot?
user2692669
  • 461
  • 8
  • 23
0
votes
1 answer

Asymptotic Notations-Big Oh Notation

What is the clear interpretation of this? O(1)+O(2)+O(3)+O(4)+O(5).......O(n) And how different is this from sigma O(i) 1<=i<=n? CLRS says it is different but does not explain how are these different?
silentseeker
  • 416
  • 5
  • 14
0
votes
2 answers

Trouble understanding little-o notation example

I'm having trouble with this one problem 9n <= cn^3 basically I can get down to 9/c <= n^2 But how do I solve the rest?
Frightlin
  • 161
  • 1
  • 2
  • 14
0
votes
2 answers

Understanding the running time analysis from an exercise of CLRS

Here's the problem I am looking for an answer for: An array A[1...n] contains all the integers from 0 to n except one. It would be easy to determine the missing integer in O(n) time by using an auxiliary array B[0...n] to record which numbers appear…
amiageek
  • 159
  • 10
0
votes
1 answer

asymptotic complexity based off running time?

How do you go about finding the asymptotic complexity based off a running time? For example: If the run time of a recursive algorithm is given as T(n) = 2 T(n/2) + O(n) considering the Master Theorem, what is its asymptotic complexity? Could…
Deekor
  • 9,144
  • 16
  • 69
  • 121
0
votes
1 answer

Asymptotic complexity of building a binary tree

What is the complexity of building a balanced binary tree of size n from scratch? Node insertion is O(log n). However, as you go along, the cumulative time is O( (log 1) + (log 2) + ... + (log (n-1)) + (log n) ). What does this "add up" to? It is…
Roam
  • 4,831
  • 9
  • 43
  • 72
0
votes
1 answer

Asymptotic complexity between n! and n^n

What would be the example of a function f(n) that is asymptotically slower than O(n^n) and faster than O(n!), i.e. O(n!) < O(f(n))< O(n^n) ?
Roam
  • 4,831
  • 9
  • 43
  • 72
0
votes
1 answer

Complete K-ary Tree

I have a complete 19-ary tree on n nodes. I mark all the nodes that have the property that all of their non-root ancestors are either oldest or youngest children (including root). I have to give an asymptotic bound for the number of marked…
Justin D.
  • 4,946
  • 5
  • 36
  • 69
0
votes
3 answers

finding complexity in an if clause

assume that I have an if clause if (!f(x)) { g(x); } the complexity of f(x) = O(x^3) and complexity of g(x) = O(x^2). In this case what is the overall complexity ? O(x^5) ? or O(x^3) ? I wanted to increase my question sizes. while(z(x)) { …
0
votes
2 answers

Implementation of dynamic hash table using chain hashing

I'm trying to implement a dynamic hash table using chain hashing (each element in the array is a linked list). I want to know, complexity wise, which of the following possibilities is better: 1. I should double the array size when the array is…
Binary
  • 147
  • 2
  • 14
0
votes
3 answers

Asymptotic. If f(n) = theta(g(n)) and g(n) = theta(h(n)), then why h(n) = theta(f(n))

it is f(n)=theta(h(n)) as theta is transitive. But Can any one explain why h(n)=theta(f(n)).
Xax
  • 185
  • 6
  • 18
0
votes
2 answers

What is the asymptotic complexity of log_2(n)-log_3(n)?

I'm trying to determine whether it is: O(1). How can I prove it? In complexity terms, log_b(n) is log(n). So is O(log_2(n)-log_3(n))=O(0)=O(1)? that doesn't seem like a strong proof. Also, this doesn't converge asymptotically, so how can it be…
0
votes
2 answers

Asymptotic run time complexity of an expression

Can I say that: log n + log (n-1) + log (n-2) + .... + log (n - k) = theta(k * log n)? Formal way to write the above: Sigma (i runs from 0 to k) log (n-i) = theta (k* log n)? If the above statement is right, how can I prove it? If it is wrong, how…