After a nightmarish ordeal of attempting to get the range swap to work, I finally found the two problems causing the code not to work. It's always something simple.
I finished the optimized version of my algorithm, and I'm quite happy with the result.
These are some attributes of my sorting algorithm:
Designing a sorting algorithm
Sort Algorithm pt. 2
You can download the source code here. This contains a simple text file as well as an HTML file with syntax highlighting. It contains the source for my sort as well as all of the other algorithms I implemented for scrutinies sake.
Download xinokSort.zip | Mirror
I have also started an open source project to implement this sorting algorithm in many programming languages.
Xinok Sort on SourceForge
Now for some benchmarks! The benchmarks of shell sort and quick sort are faster than in previous posts because I further optimized them. The characters on the right are MD5 hashes, to verify the array was sorted correctly.
Shuffled:

Shuffled 4x Larger Array: (To show how well my algorithm scales) (there wasn't enough memory left for radix sort)

Sorted Array:

Partially Sorted Array: (2048 elements were swapped and out of place)

Reversed Array: (elements are in descending order)
These are some attributes of my sorting algorithm:
- It is a stable sort
- Low memory requirement (only a few extra KiB is required)
- It's a divide and conquer algorithm, which makes it easy to parallelize
- Good performance (not as fast as quick sort, but only a little bit slower than merge sort, and faster than shell sort)
- Faster on sorted or partially sorted data
- Similar to Timsort, except for the range swap
- The range swap is pretty fast at reversing elements in descending order
- Minimal risk of stack overflow using tail calls
Designing a sorting algorithm
Sort Algorithm pt. 2
You can download the source code here. This contains a simple text file as well as an HTML file with syntax highlighting. It contains the source for my sort as well as all of the other algorithms I implemented for scrutinies sake.
Download xinokSort.zip | Mirror
I have also started an open source project to implement this sorting algorithm in many programming languages.
Xinok Sort on SourceForge
Now for some benchmarks! The benchmarks of shell sort and quick sort are faster than in previous posts because I further optimized them. The characters on the right are MD5 hashes, to verify the array was sorted correctly.
Shuffled:

Shuffled 4x Larger Array: (To show how well my algorithm scales) (there wasn't enough memory left for radix sort)

Sorted Array:

Partially Sorted Array: (2048 elements were swapped and out of place)

Reversed Array: (elements are in descending order)





