In the worst case, $j$ comparisons are required to insert the $jth$ element into the correct position. For the insertion sort algorithm, the running time complexity would be $\mathcal{\Theta}(n^2)$ for the number of comparisons as follows:
$$2+3+\textit{…}+n=\frac{n(n-1)}{2}-1$$
Question: Why the number of comparisons start from $2$ above although I think it should start from $1+2+3\textit{…}$?
Best Answer
Cause it does it twice. First it asks: is $a_2>a_1,$ the answer is yes, then it does $i=i+1,$ so $i=2$ now and then it asks $a_2>a_2.$ is false and it breaks.
As you see there were two comparisions.