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

Complexity function

could you help me to determine whether the following function of complexity: f(n)=5n^3+1800nlogn+18 is of order O(n^2), O(n^4), OMEGA(n^3),OMEGA(n^5),TETA(n^3),TETA(n^5) I think it is O(n^4), TETA(n^3) is right? I arrived at this solution because I…
Enzo
  • 296
  • 1
  • 3
  • 11
0
votes
3 answers

Asymptotic Expected Running Time

I'm having some trouble with an asymptotic analysis question. The problem asks for both the asymptotic worst case running time and the asymptotic expected running time of a function. Random(n) generates a random number between 1 and n with uniform…
0
votes
3 answers

C loop complexity

I'm preparing for an exam and these are some of problems from last year's tests. The task is to calculate both exact and asymptotic complexity. How would you solve it? Universally, if possible. for ( i = j = 0; i < n; j ++ ) { doSomething (); i…
user267817
0
votes
1 answer

Number of addition and multiplication operators in this algorithm

Consider the following algorithm: i := 1 t := 0 while i ≤ n t := t + i i := 2i I'm interested in finding out how many addition and multiplication operations this algorithm executes; however, I'm running into trouble. I understand…
0
votes
2 answers

Analyzing Running Time

def foo(x): if x > 5: return foo(x–1) – foo(x-1) else: return 77 def bar(a,b): if (b > 0): return bar( bar(a, b+1) , b-1 ) else: return 0 Could someone walk me through on how to find the running…
0
votes
1 answer

asymptotic notation of constant input

If I have an algorithm,where the input is just a number and the output is its set of divisors.So my input will always be one number and the number of iterations in the algorithm will depend on how big the number is.What will be the big-oh notation…
parth
  • 272
  • 1
  • 9
  • 20
0
votes
2 answers

Time complexity, binary (search) tree

assume I have a complete binary tree up-to a certain depth d. What would the time complexity be to traverse (pre-order traversal) this tree. I am confused because I know that the amount of nodes in the tree is 2^d, so therefore the time complexity…
dgamma3
  • 2,333
  • 4
  • 26
  • 47
0
votes
3 answers

Sort then split a PHP array?

Here is a var_dump of my array: array(6) { [0]=> string(4) "quack" ["DOG"]=> string(4) "quack" [1]=> string(4) "quack" ["CAT"]=> string(4) "quack" [2]=> string(4) "Aaaaarrrrrggggghhhhh" ["CAERBANNOG"]=> string(4)…
stackoverflowuser95
  • 1,992
  • 3
  • 20
  • 30
0
votes
1 answer

Ordering functions by Big O complexity

I'm trying to order the following functions in terms of Big O complexity from low complexity to high complexity: 4^(log(N)), 2N, 3^100, log(log(N)), 5N, N!, (log(N))^2 This: 3^100 log(log(N)) 2N 5N (log(N))^2 4^(log(N)) N! I figured this out…
user1411893
  • 608
  • 2
  • 8
  • 19
0
votes
1 answer

What is the computational complexity of this function?

I was wondering what the computational complexity of this function would be? 2^(log(n)-1) the log is base 2.
dgamma3
  • 2,333
  • 4
  • 26
  • 47
0
votes
2 answers

Regarding complexity of an algorithm with steps C(n+r-1, r-1)

If an algorithm requires C(n+r-1, r-1) steps to solve a problem, where n is the number of input, and r is a constant, does the steps of algorithm consider exponential growth?
0
votes
3 answers

time and space complexity

I have a doubt related with time and space complexity in following 2 case Blockquote Case I: Recurion: Factorial calculation. int fact(int n) { if(n==0) return 1; else return (n*fact(n-1)); } here how come time complexity…
dead programmer
  • 4,223
  • 9
  • 46
  • 77
0
votes
2 answers

Big Theta, Big O, Big Omega for a given function

Consider the function F: 2^(3*n) + n^2 Can the function A: 2^(3*n) be used as a Big Theta, Omega or O as a characterisation of F? Why? I'm revising the concepts of Big Omega, Big Theta and Big O and I came across this example but don't know where to…
Sorin Cioban
  • 2,237
  • 6
  • 30
  • 36
0
votes
1 answer

Is O(LogN) == O(3LogN)?

I just started a course on Asymptotic Analysis and in one of our assignments I am supposed to add functionality to a function without changing the complexity. The complexity is log(N). The homework guideline asks me specifically to change the…
devjeetroy
  • 1,855
  • 6
  • 26
  • 43
0
votes
2 answers

Determining Asympotic Notation

I have a set of problems where I am given an f(n) and g(n) and I am supposed to determine where f(n) is O(g(n)), Ω(g(n)) or Θ(g(n)) And I must also determine the c(s) and n0 for the correct relationship. How do I get started on a problem like…
user906153
  • 1,218
  • 8
  • 30
  • 43