Top "Complexity-theory" questions

Computational complexity theory is a branch of the theory of computation in theoretical computer science and mathematics that focuses on classifying computational problems according to their inherent difficulty.

When will the worst case of Merge Sort occur?

I know that worst case on mergesort is O(nlogn), the same as the average case. However, if the data …

arrays algorithm sorting complexity-theory time-complexity
Example of O(n!)?

What is an example (in code) of a O(n!) function? It should take appropriate number of operations to run …

java algorithm big-o complexity-theory factorial
Exactly how many comparisons does merge sort make?

I have read that quicksort is much faster than mergesort in practice, and the reason for this is the hidden …

algorithm sorting complexity-theory quicksort mergesort
Hashtable in C++?

I usually use C++ stdlib map whenever I need to store some data associated with a specific type of value (…

c++ performance map hashtable complexity-theory
How many comparisons will binary search make in the worst case using this algorithm?

Hi there below is the pseudo code for my binary search implementation: Input: (A[0...n-1], K) begin l ← 0; r ← n-1 …

arrays algorithm complexity-theory binary-search
How to calculate time complexity of backtracking algorithm?

How to calculate time complexity for these backtracking algorithms and do they have same time complexity? If different how? Kindly …

algorithm complexity-theory time-complexity backtracking
What is the complexity of these Dictionary methods?

Can anyone explain what is the complexity of the following Dictionary methods? ContainsKey(key) Add(key,value); I'm trying to …

c# complexity-theory time-complexity
Big O, what is the complexity of summing a series of n numbers?

I always thought the complexity of: 1 + 2 + 3 + ... + n is O(n), and summing two n by n matrices would be O(…

performance algorithm optimization complexity-theory big-o
Solving T(n) = 4T(n/2)+n²

I am trying to solve a recurrence using substitution method. The recurrence relation is: T(n) = 4T(n/2)+n2 My …

algorithm complexity-theory recurrence
Solving the recurrence relation T(n) = √n T(√n) + n

Is it possible to solve the recurrence relation T(n) = √n T(√n) + n Using the Master Theorem? It is …

math recursion complexity-theory big-o recurrence