Linked Questions

40 votes
5 answers
121k views

I've not gone much deep into CS. So, please forgive me if the question is not good or out of scope for this site. I've seen in many sites and books, the big-O notations like $O(n)$ which tell the ...
Code0987's user avatar
  • 523
1 vote
2 answers
10k views

I am trying to learn how to determine time complexity. Sometimes, I see complexity as $\log n + \log n = 2\log n$ but sometimes I see complexity as $\log n\cdot\log n$ which is $(\log n)^2$. Suppose ...
user2072374's user avatar
0 votes
2 answers
12k views

I'm trying to prove that the following recurrence relation has a runtime of O(n): fac(0) = 1 fac(n+1) = (n + 1) * fac(n) ...
Todd Davies's user avatar
2 votes
1 answer
5k views

Currently, I'm reading Data Structures and Algorithms in Java, 6 edition by Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser link, particularly a chapter about recursions. There is an ...
Sultan's user avatar
  • 21
0 votes
0 answers
10k views

How can I find out the time complexity for the brute-force implementation of matrix multiplication for: Two square matrices ($n \times n$), Two rectangular matrices ($m \times n$) and ($n \times r$)?
oneCoderToRuleThemAll's user avatar
-1 votes
1 answer
4k views

I am looking for the time complexity of the following nested loops, where the inner loop is shrinking. ...
Rizwan Ahmed's user avatar
2 votes
3 answers
3k views

I am revising for my algorithms exam and I have come across one topic in particular that I do not quite understand; which is how to analyse dependent nested loops. I know if we have a 2-nested loop, ...
Confuto's user avatar
  • 123
2 votes
3 answers
1k views

I need to find the time complexity of the following simple algorithm. Calculate the time complexity of the following algorithm: ...
EMDB1's user avatar
  • 131
1 vote
2 answers
4k views

In order to find Big O for a recursive algorithm, it is needed to know the stopping criteria of that algorithm. For the recursive algorithm to find Factorial of a number it is very easy to find the ...
J. Doe's user avatar
  • 51
0 votes
2 answers
5k views

I am working with this problem: What is the asymptotic running time of the following piece of code? ...
Martin Andersen's user avatar
1 vote
1 answer
3k views

I am confused on the following: In the following trivial code: ...
Jim's user avatar
  • 183
2 votes
1 answer
452 views

I'm confused about the complexity of the following code: for(i=1; i<=n; i = 2*i) for(j=1; j<=i; j++) print A[j] I know that the first loop is ...
TacoB0t's user avatar
  • 163
0 votes
1 answer
2k views

I am a novice programmer and very weak in complexity calculation. I have learnt to write a program for creating all possible subsets from a set of elements, i.e. knapsack algorithm. Now I would like ...
awlad hossain's user avatar
-1 votes
1 answer
2k views

The following is pseudo code and I need to turn it into a a recurrence relation that would possibly have either an arithmetic, geometric or harmonic series. Pseudo code is below. I have so far T(n) =...
user5428151's user avatar

15 30 50 per page
1
2 3 4 5
20