I took a quick look at your code, which looks great btw, and noticed the sort might not be stable.
// array[0] and array[2]
// array[1] and array[3]
// array[0] and array[1]
// array[2] and array[3]
// array[1] and array[2]
If you change this to:
// array[0] and array[1]
// array[2] and array[3]
// array[1] and array[2]
// array[0] and array[1]
// array[2] and array[3]
// array[1] and array[2]
it should be stable, since you'll always be comparing adjacent elements. It's possible to do it with 5 comparisons, but you'll need a pretty complex decision tree to keep it stable.
I am very glad that you like my sort. I am very thankful for your correction to this algorithm now it will be stable. And I will test it and also compare it with all other sorts its execution times.
I took a quick look at your code, which looks great btw, and noticed the sort might not be stable.
If you change this to:
it should be stable, since you'll always be comparing adjacent elements. It's possible to do it with 5 comparisons, but you'll need a pretty complex decision tree to keep it stable.