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

Finding asymptotic upper and lower bound?

If we assume T(n) is constant for small n, how can we find the solution of this function? T(n) = T(n−2) + 2logn So far, I am unable to find a way to represent the whole function. Can you please help me? I really want to understand.
-2
votes
3 answers

the smallest algorithm’s asymptotic time complexity as a function of n

we have known some of the algorithm’s asymptotic time complexity is a function of n such as O(log* n), O(log n), O(log log n), O(n^c) with 0< c < 1, .... May I know what is the smallest algorithm’s asymptotic time complexity as a function of n ?…
super1ha1
  • 629
  • 1
  • 10
  • 17
-2
votes
4 answers

What is the complexity of this program?

I want to analyze the execution time complexity of the below program. Please answer with the explanation. private static void printSecondLargest(int[] arr) { int length = arr.length, temp; for (int i = 0; i < 2; i++) { for (int j =…
-2
votes
1 answer

Prove f(n) is always O(f(n-1))

Assume that f(n) goes to infinity as n goes to infinity. This is a homework problem and I would appreciate an idea/guidance instead of the complete answer.
Arun Kumar
  • 101
  • 2
  • 10
-2
votes
2 answers

Comparing big theta values

I am trying to order these different big theta values from largest to smallest: Θ(n2) Θ(2n log n) Θ(n log n2) Θ(2n2) Θ(log n) Θ(n log 2n) Θ(k2) Θ(22n) Θ(n3) Θ(n) Θ(2n) Θ(n1.5) Θ(√n) Θ(2n2) and some of the values are equivalent. Particularly, I want…
adub3
  • 141
  • 3
  • 9
-2
votes
1 answer

Time complexity of a recursive function

I have a Java function that receives a matrix (2-dimensional array[][]) and creates a dynamic array of options of changes for this array, and then recursively creates a dynamic array for each option of the dynamic array. Eventually for each option…
-2
votes
2 answers

How to calculate O(n, x) for a given algorithms by examples?

I want to calculate the running time O(n, x) = Theta(n, x) for a given algorithm depending on n and x by a big amount (> 100) of examples (how long the algorithm will take for n and x). Is there actually a way to do this? I know that the running…
-3
votes
1 answer

Is 2^(log n) = O(log(n))?

Are these two equal? I read somewhere that O(2lg n) = O(n). Going by this observation, I'm guessing the answer would be no, but I'm not entirely sure. I'd appreciate any help.
kurikuone
  • 17
  • 1
  • 2
-3
votes
1 answer

Time complexity of the following function

Please help me by giving the time complexity analysis of the following function. function (n) { for( i = 1 ; i <= n ; i + + ) { for( j = 1 ; j <= n ; j+ = i ) { print( “*” ) ; …
-3
votes
2 answers

Stuck at Algorithm pseudocode generation

I do not know what to do next (and even if my approach is correct) in the following problem: Part 1 Part 2 I have just figured out that a possible MNT (for part a) is to get a jar, test if it breaks from height h, if so then there's the answer, if…
-3
votes
1 answer

Determining the asymptotic complexity in the worst case (O(N)) of a specific function

I would like to determine the asymptotic complexity in THE WORST CASE the following function: int j; float r = 1.0; for (int i=1; i<(log n); i++){ j = 1; while (j <= i^2){ r*=2; j++; } print(r);
-3
votes
1 answer

Time Complexity Analysis for Non-ovarlapping Subproblem Recursive Solution

Here I am just putting python code. Rec(Arr,N,K,X) : if(X==0 and K==0): return 1 elif(X<=0 or K<=0 or N<0): return 0 else : return Rec(Arr,N-1,K,X)+Rec(Arr,N,K-1,X-Arr[N]) Provided that all element of Arr…
-3
votes
2 answers

Prove that 5^n = o(n!)

Please help me providing a direction on how to prove this. I can prove by randomly finding value of n that makes n! greater than 5^n. But can someone help me prove mathematically.
Hanusri
  • 1
  • 2
-3
votes
2 answers

Solving recurrence T(n) = T(n/2) + 2T(n/4) + n?

I am studying about recurrences using my friend's pdf (Algorithms Unlocked) and trying to solve the problems about recurrences and it is not yet clear to me about the mechanics of the recursion tree(I assume this is the method to be used on this…
Simoun
  • 25
  • 1
  • 2
-3
votes
1 answer

Asymptotic Analysis: Populating a long repeated list. HTML vs. JavaScript?

I'm making my portfolio website here, and I'm wondering if I should replace my LONG HTML5 code that populates my skills/projects/project modals into javascript that runs in a for loop. I know it won't matter much because it is not like thousands of…
Saehun Sean Oh
  • 2,103
  • 1
  • 21
  • 41