The Danger of Naïveté

Nice post. One comment about the implementation - i think it’s probably more efficient to implement a pre-decrement rather than a post-decrement.

The post decrement you have implemented evaluates to True following the end of the iteration with i=1, and then performs a pointless swap of the first item of the array with itself.

if you implement a pre-decrement the loop statement will evaluate to false and that final, pointless swap wont take place.