educative.io

Educative

Runtime of nested loop with index modification - Time Complexity = O(n)

Please explain me the following things:
image
Why are we considering from 1 to n-1, instead of 0 to n-1. Then we could have said logn steps.


how did this become: 2n -3? please elaborate the math. I was also thinking the formula would have been (2^(log(n-1)+1) + 1) / log(n-1) - 1


Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers