Talk:Sort stability: Difference between revisions

no edit summary
No edit summary
Line 23:
==GAP and stability?==
Does GAP seem stable with the example given in the task description? I find it hard to follow what is being described in the GAP example. (Maybe some of the notes would be better off here in the talk page and maybe expanded apon)? --[[User:Paddy3118|Paddy3118]] 21:41, 12 June 2011 (UTC)
:I thought it was easy, you can see the R implementation (which I also wrote), mayber it's easier to read. The idea: sort an array of random values A/B, and get the sorting permutation. Then apply this permutation on an array of already sorted integers 1..n. In the result, there are two blocks, one for A and the other for B. If integers are sorted in both blocks, then the sort is stable in this case (I assume you understand why !). Of course I didn't prove it's stable in all cases, but I was not able to find a counterexample. Usually, an unstable sort fails even on such trivial examples (again, see R).
[[User:Toucan|Toucan]] 08:30, 13 June 2011 (UTC)
506

edits