nIf there are n elements in the list, the outer loop is performed n-1 times.
The inner loop is performed
n-first times. i.e. time= 1, n-1 times; time=2,
n-2 times; … time=n-2, 1 times.
n(n-1)x(n-first) =
(n-1)+(n-2)+…+2+1 = (n2-n)/2
nAs n increases, the
time to sort the list goes up by this
factor (order n2).
n