With the likes of the other n2 sorting algorithms like Bubble, Selection, and Insertion which 'worst case' does 18 element compares, or so, on a 10 element array in order to get 2 elements in order, I 'sort of' found one that does this with measly 13 element compares! Though this is a constant pace; there is no 'worst case', in a sense.
Not really ground breaking as it's only 40% faster than Bubble, maybe 50% if I revise the code, and it's slower than Selection. However, in theory, it's the fastest n2 algorithm in terms of number of compares. The downfall is that it does a lot of switches in practice.
I achieve this by first doing compares of every other two elements. 'Pairing'.
x cmp x[i+1]; i+=2;
With this I know for a fact that the 'set' of the latter and former of compared elements contain both the highest and lowest elements, which I called the extremes. It's just a matter of looking for them: Selection. Voila!
I guess where I'm getting at is does this already exist? Or is this just a convoluted variant of an existing one? I'd like to get some extra credit but I wouldn't want to submit a used idea. Also, what do you think?
I may have written it a bit 'cryptic' as to maybe minimize random ripoffs. lol