Don't you hate it when you're trying to roughly sort a list based on user data, but you have to poll the user for thousands of comparisons?
Hate no more, because the answers to this challenge are (going to be) here!
The sorted-ness of a list is defined by how many possible comparisons it has which are correct.
Let's have an example. The list
[1, 2, 4, 3] has the possible comparisons
1 <= 2,
1 <= 4,
1 <= 3,
2 <= 4,
2 <= 3 and
4 <= 3. 1 out of those 6 comparisons are incorrect, so this list is (5 / 6) * 100 = 83.33% sorted.
Create a program or function that sorts a given list (but not necessarily 100%) and sorts all of the below test cases by at least 75%.
If your program sorts a list by less than 75% that is not in the test cases, that's okay, but try not to hard-code to the test-cases although I can't ban you from doing so.
You must use a comparison sort. Pretend the numbers are black boxes that only support comparison operations.
Your program may sort the list backwards, which means if it's is able to sort all of the test cases by less than 25%, you can post it as a backwards sort.
For programs that perform STDIO, the list should be taken and printed as base-10 integers with some kind of separator, with optional text at the start and end (for example
[1, 2, 3])
You may also return or print a list of indices that correspond to the sorted list (e.g.
[1, 3, 2] when sorted is indices
[0, 2, 1])
You may not compare any of the elements of the list with any constant values.
A comparison is defined as any operation that involves a value
x from the given list and another value
y which may or may not also be from the given list, and does a boolean check of one of
x < y,
x <= y,
x == y,
x >= y or
x > y or returns a result depending on whether
x < y,
x == y or
x > y. This includes any expressions, including mathematical equations, that have the same effect of comparison.
The test cases are here.
To verify your sorted lists, use this program.
The lowest score wins. Good luck!