in

I present you: The Miracle Sort

I present you: The Miracle Sort | code-memes, computer-memes, array-memes, IT-memes | ProgrammerHumor.io
code-memes, computer-memes, array-memes, IT-memes | ProgrammerHumor.io

Content

Introduction Prerequisites: Miracles, Sense of Humour Miracle sort is a sort that truly requires a miracle. We keep checking the array until it is sorted. It requires that some external force (a miracle?) changes some bits in the computer in a way that it becomes sorted. Implementation We keep checking if the array is sorted until some miracle occurs. Code 1. public void miraclesort (intJ arr) boolean sorted false; do sorted true; for (int i 1; i arr. length; i) if (arri arri – 1) sorted false; break; g. 10. 11. 12. while (sorted);