
11 Mar
2008
11 Mar
'08
11:46 a.m.
On Tue, Mar 11, 2008 at 4:01 AM, Adrian Hey
and sorting is meant to be a permutation, so we happily have the situation where this has a correct answer: 2.
Anything else is incorrect.
Isn't 3 also a permutation? Why is it incorrect?
Because it is not stable. The documentation for Data.List.sort says the sort is stable: "The sort function implements a stable sorting algorithm." A stable sort respects the order of equal elements as they occur in the input list. -- Denis