Hi ikegami,
can you please explain why using the use sort 'stable'; pragma would be important? Admittedly, the sorting block is peculiar and treats non 0 values as equal so that non 0 values may be reshuffled in the process (as would be the case using quick sort). However, since Perl 5.8, the default sorting algorithm (merge sort) is inherently stable, so I would expect the order of non 0 values to be preserved. Is there anything that I am missing?
| [reply] [d/l] |
| [reply] |
Thank you, Dave, for your answer, but I think that the merge sort algorithm is inherently stable, independently of its specific implementations. But you are probably right that it is better not to take any cnance and make sure that stability is guaranteed.
| [reply] |
Thanks, I forgot about stability, especially when my single test case workeed correctly.
| [reply] |