What if I wanted to sort a list of integers, but with the added condition that the list was cyclical and the sorted data could "start" at any point? e.g. the list [7, 4, 2, 5, 3] could be sorted as [2, 3, 4, 5, 7], [5, 7, 2, 3, 4], [4, 5, 7, 2, 3], etc.
Would an algorithm that implements this sort be more efficient than a standard sort? It seems like since there are now n solutions instead of just 1, sorting the list should be n times easier and thus only take O(log n) time. But I think that's probably bullshit.
sub oh_en_sort {
for (@_) { @a[$_] = $_; }
return @a;
}
boom, O(n) sort. For 1..n sequences only, though. You could add a grep{/./} in there to remove empty array elements but that would increase the complexity.
Name:
Anonymous2013-03-18 19:04
Fibonacci buttsort.
Name:
Anonymous2013-03-18 19:18
/prog/ already invented sleepsort, the only sort you'll ever need.
>>6
What the fuck is $kN$ and how is it different from $n$?
Name:
Anonymous2013-09-01 13:38
Ruitomo? Killing curse that's not unique to you is good enough.
Name:
Anonymous2013-09-01 15:09
How are little girls disgusting? If that's not it, how is a grown man masturbating to little girls any more disgusting than another grown man masturbating to women?