Worst case
Best Case
In worst case, Outer loop will be executed n-1 times while inner loop will be executed j-1. So the time complexity in worst case is:
T(n) = n(n-1)/2
T(n) = Θ(n2)
While in best case inner loop will never be executed so the time complexity in best case:
T(n) = Θ(n)
Need to have these two algorithms compared and how they differ.