In average case, if n is even and except the first iteration, both Step 2 and Step 4 of the previous section, execute because the first iteration does not require the inner loop to execute. As a result, the number of iterations required ¼0þ1þ2þ3þþ n2ðÞ =2 ¼ n2 ðÞ *n 4 ðÞ ðÞ =8 ¼ n2 6nþ8 =8 If n is odd, the algorithm requires an extra iteration of the inner loop due to Step 7 of the previous section. As a result, the total number of iterations for odd number of elements is ((n2 − 6n + 8)/8) + 1. Thus, the average case time complexity is O(n2).