I've had this idea in the back of my mind for a really janky sorting algorithm variant.
So, for those uninitiated, let's go over what we mean by 'sorting algorithm' first:
Say you have a set of things that are all different shades of, I don't know, blue. You want them sorted by saturation, and you could do so yourself, but let's say there's 1000 of these objects and it's just not practical to do by hand. So you build a machine that looks at two objects, compares their saturation, and if necessary, swaps them so the more saturated one is on the left. The program you have this machine follow is a sorting algorithm. The items (files on a computer, etc) are collectively referred to as the array.
So, within this space there's a sorting algorithm that's sort of designed as more of a joke than anything, called "bogosort". Bogosort checks the array, and if even one pair is not properly sorted, rather than just swap them it randomizes the order of the whole array. Repeat ad nauseam until, by pure luck, it is sorted.
And here is the horrible sorting algorithm that has been vexing my mind since appearing within:
OPTIMIZED BOGOSORT
So, this changes the rules a little. Each item in the array is assigned a number. The sorting system knows which number it wants to see in a given spot.
With Optimized Bogosort, if an item in the array is found to already be in its individual correct spot, it is 'locked'. Locked items are not randomized with the rest of the array. It is otherwise identical to bogosort.
