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

building/inserting into sorted list

Here's the question at hand: You have a set of N random numbers to be inserted into a sorted List (smallest to largest). What would be the worst-case asymptotic time performance for building the entire list? I know how to insert a sorted list in…
pfinferno
  • 1,779
  • 3
  • 34
  • 62
0
votes
2 answers

Analyzing function runtime complexity

I've written a function append() in Java and I need to analize its runtime complexity by O(N) and Θ(N). This is the original question: Suppose append()'s runtime complexity is t = O(N), it's mean that t can also be represented by t = C*N. (as C is…
Billie
  • 8,938
  • 12
  • 37
  • 67
0
votes
1 answer

Analyzing complexity for a code fragment

Let A be an array[1..n] which has zeros and ones in it.and func() be function whose complexity is theta(m).For the given pseudo code what would be the complexity? counter=0; for(i=0;i
Diljit PR
  • 301
  • 3
  • 14
0
votes
1 answer

Finding average case complexity with probability

Lets say we have a string n, which can either be populated with "a"s or "b"s ex: n = "aaabbbab", "ababababab" and so on. and we define a function called HalfA(n): count a = 0; for each i in n: if n == 'a' i++; if i >=…
user65663
  • 149
  • 1
  • 1
  • 4
0
votes
2 answers

Time complexity for element repetition in array

Given an array of n random numbers, find a O(n*ln n) algorithm to check if it contains repetitive occurrences of some number using only arrays (no other complex data structures). I got the obvious O(N*N) when you take each element and compare with…
codepk
  • 605
  • 2
  • 10
  • 23
0
votes
1 answer

Time Complexity of Counting Change

I have a similar problem to link: coin change algorithm in scala using recursion The Code is recursive and looks like: def countChange(money: Int, coins: List[Int]): Int = { def count(capacity: Int, changes: List[Int]): Int = { …
JASON
  • 7,371
  • 9
  • 27
  • 40
0
votes
1 answer

Define Asymptotic Run Time of Parallel Algorithm

I am newbie to understanding Parallel Algorithms. Can someone please explain in simple words [or examples] what Asymptotic Run Time of a Parallel Algorithm means? Context: If the best known sequential algorithm for a problem π has an asymptotic run…
0
votes
2 answers

How many subproblems can this recurrence have while still being faster than an initial recurrence?

I'm having some trouble with an asymptotic analysis question : My Question is to calculate maximum value if 'a' as stated in my question: An Algorith A has running time T(n)= 7T(n/2) + n^2 and Algorith B has running time T' = aT'(n/4) + n^2. What…
AppleDroid
  • 281
  • 1
  • 2
  • 12
0
votes
1 answer

What is the asymptotic relation between functions

I want to know the reason of following given relations: n < (log n)^log n log log n = O(root(log n)) (log n) != omega(log(n!)) log(log*n) < log*(log n) base of all log is 2. Obviously I know the answers but I do not know how to find them.I could…
WSS
  • 503
  • 5
  • 20
0
votes
3 answers

Is O(log(n*log n) can be considered as O(log n)

Consider I get f(n)=log(n*log n). Should I say that its O(log(n*log n)? Or should I do log(n*log n)=log n + log(log n) and then say that the function f(n) is O(log n)?
user2781902
  • 63
  • 1
  • 7
0
votes
1 answer

What is the worst-case time for insertion sort within merge sort?

Recently I stumbled upon this problem from Introduction To Algorithms Edition 3 Problem 2-1: Although merge sort runs in O(n logn) worst-case time and insertion sort runs in O(n^2), the latter runs faster for small problem sizes. Consider a…
Ghost
  • 1,777
  • 6
  • 31
  • 44
0
votes
3 answers

Using worst/avg/best case for asymptotic analysis

I understand the worst/avg/best case are used to determine the complexity time of an algorithm into a function but how is that used in asymptotic analysis? I understand the upper/tight/lower bound(big O, big omega, big theta) are used to compare two…
0
votes
1 answer

Karatsuba for multiplying m and n digit integer

I was trying to analyse karatsuba algorithm for multiplying an m and an n digit integer. As i understand, it will be most efficient if the integers are divided into m/2 and n/2 digit sub problems. The issues are as follows:- Can we apply gauss…
anuag
  • 1
  • 1
0
votes
1 answer

Time complexity of the given C function theta(nlogn) or theta(n^2logn)?

I have calculated the time complexity of the following C function and it is coming to theta (nlogn).Can you tell me whether i am wrong,the answer given was theta(n^2logn)?I have just started reading about these concepts. int unk(int n) { int…
C_beginner
  • 305
  • 1
  • 4
  • 12
0
votes
1 answer

Randomized Quick Sort Pivot selection with 25%-75% split

I came to know that in case of Randomized quick sort, if we choose the pivot in such a way that it will at least give the split in the ration 25%-75%, then the run time is O(n log n). Now I also came to know that we can prove this with Master…