Incomparable Sort


I've had an idea for a while about how to best sort a list of stuff that doesn't have a quantifiable value. For example if you had a list of movies it's not that simple to just put a score on a movie, there are many factors to account for. It's easier instead to just compare two movies and decide which one is better. And that is where the program above comes in. You put in a list of stuff that isn't easily comparible and will give you the best sorted list possible based on your judgement.

The algorithm used above is merge sort. The reason I chose merge sort is because it performed the best out of all the algorithms I implemented. Below is a table with three algorithms, three sets of randomly sorted items, and the amount of comparisons needed to completely sort the set of items.                

  1 2 3
Quick 77 80 87
Merge 61 65 62
Heap 116 109 115

In normal circumstances quick sort performs better than merge sort because it doesn't need to create extra space and it works well with the way that memory is handled in computers. But the things that make quick sort better than merge sort in normal circumstances doesn't matter since the slowest part of this entire process are the comparisons. The fewer comparisons that need to be made the faster the sorted list can be returned to the user.

One challenging part of writing this was adding the async parts to wait for the user. I took the merge sort algorithm from here, but modified it to use async functions to wait for the users decision when a comparison is needed.

You can view the code for the program here.