in reply to Re^2: move all 0s in an array to the beginning keeping other elements order same
in thread move all 0s in an array to the beginning keeping other elements order same
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: move all 0s in an array to the beginning keeping other elements order same
by davido (Cardinal) on May 05, 2014 at 04:36 UTC | |
by Laurent_R (Canon) on May 05, 2014 at 06:09 UTC | |
by davido (Cardinal) on May 05, 2014 at 06:35 UTC | |
by ikegami (Patriarch) on May 31, 2014 at 04:58 UTC | |
by Laurent_R (Canon) on May 31, 2014 at 08:15 UTC |