I am trying to see the difference of how we are solving this example (nested for loop with dependent) vs Big O of a Nested Loop with Addition.
In the dependent example we say that the statement in the inner loop running time is cn(n−1)/2 but in almost all the following challenges and in the example of the addition challenge we say the statement in the inner loop runs (n/3 * n/2) steps. In the challenges we often calculate the steps by multiplying the steps of the outer loop * steps of inner loop.
In the dependent example we use cn(n−1)/2 instead of saying that the outer loop runs n times and the statement in the inner loop as well so we can do n * n steps.
Why do we not use the n(n−1)/2 in the Nested Loop with Addition challenge or other challenges as well ?
Course: https://www.educative.io/courses/big-o-notation
Lesson: Educative: Interactive Courses for Software Developers