An easy upper bound is obtained by bounding the two loops by n. This gives a running time of O(n2).
Is the worst-case running time ? That is, are there inputs for which running time is quadratic?
.
Is the running time ? That is, is it quadratic for all inputs? What is a best-case input for insertion sort?
.