educative.io

Educative

Nested For-loop With Index Modification

Nested For-loop With Index Modification, can you please explain this scenario like the explanation for ### Nested For-loop with dependent variables.

Like counting the number of times the inner loop will run based on the outer loop index values.

Please let me know if this is correct.
The inner loop:

  1. j=0 initialisation will take log(n-1) time
  2. the body will take c(2n-3)
  3. j < i will take 2n-3+1 = 2n-2
  4. j++ will take (2n-3)-1 = 2n-4
    what will be the time taken for outer loop?