We don't count the moment that the condition of the loop fails, since the sequence of statements is not going to be executed at all ;)
As for the English, make sure you keep up with this forum......
Type: Posts; User: std10093
We don't count the moment that the condition of the loop fails, since the sequence of statements is not going to be executed at all ;)
As for the English, make sure you keep up with this forum......
Let's solve it :)
Σ[base:i=0, upperBound:i=N-1] Σ[base:j = i+1, upperBound:j = N-1] 1
= Σ[base:i=0, upperBound:i=N-1] (N - 1 - i - 1 + 1) 1
= Σ[base:i=0, upperBound:i=N-1] ( N - 1 - i )
=...
The second one is true because of linearity...
The first one:
j will take the value of i+1... As a result, it will start from value 1, when you meet the inner loop for first time... Then, when...
I thought you implied that this way of declaring a 2D array was incorrect.
You are welcome :)
PS - Χρόνια πολλά για την Εθνική μας εορτή!
Well, this goes out of bounds. But let's say we have i and j (the complexity won't change). When I say complexity, I mean time complexity.
The complexity will be Ο(nē).
Τhe explanation is as you...