The number of comparisons and multiplications for the following algorithm should be:
$$\sum_{i=1}^{n}(n-i)\times 2$$
2 as the amount of operations for multiplication is same as for comparisons.
Question: But the solution I found claims that it's $n\times (n-1)\times 2$, could you pleas state why?
Edit: I found out the solution as follows:
$$\sum_{i=1}^{n-1}(n-i)\times 2$$ $$2\times \sum_{i=1}^{n-1} n-2\times \sum_{i=1}^{n-1}i$$ $$2\times (n)(n-1) -2\times \frac{(n-1)n}{2}$$ $$2\times (n)(n-1)$$
