Skip to main content

All Questions

Tagged with
2 votes
2 answers
603 views

Is a procedure's complexity a function of how many nested loops it has?

Take this example public static boolean uniqueNumbers(int[] x){ for(int i = 0; i <x.length; i++){ for(int j = 0; j <x.length; j++){ if(i != j && x[i] == ...
Adam's user avatar
  • 141
-1 votes
1 answer
60 views

Time complexity Computation

What will be the result of the time complexity of this piece of code i.e. int sum(int A[], int n) { int sum = 0, i; for(i = 0; i < n; i++) { sum = sum + A[i]; } ...
raphael's user avatar
  • 11
5 votes
1 answer
104 views

Prove complexity for a generic algorithm

I'm new to theory of complexity and am trying to prove a fact. So, let's consider an algorithm T that receive at input an integer n. That algorithm has a time complexity for n = 1 : θ(1) and for n > ...
Madix's user avatar
  • 61
8 votes
2 answers
1k views

Does Time Complexity analysis factor for cache performance of an algorithm?

If I have an algorithm A. and it has fewer instructions than algorithm B. but performs worse on a CPU due to poor memory coalescing (and hence, poor CPU cache performance), does that factor into the ...
metamorphosis's user avatar