#SmileBASIC, 79 bytes DEF S A FOR Z=0TO I FOR I=1TO LEN(A)-1SWAP A[I-(A[I-1]>A[I])],A[I]NEXT NEXT END It's bubble sort but instead of checking to see if it's finished, it just assumes that every input is the worst case and does n^2 (actually n*(n+2)) iterations.
12Me21
- 6.7k
- 1
- 22
- 40