Talk:Sorting algorithms/Radix sort

From Rosetta Code
Revision as of 13:25, 19 January 2011 by rosettacode>Dingowolf (→‎Negatives: signed, thx remind)

Negatives

Beware negative number handling! See Wiki's python demo. dingowolf 13:25, 19 January 2011 (UTC)

An interesting problem; the easiest way to handle it seems to me to be to double the number of bins and put negative values in the first half and positive in the second. Or at least it produces correct results when I implemented it in the Tcl solution. (I suspect that the original algorithm simply didn't implement them, or sorted by printed digit instead of logical digit.) –Donal Fellows 13:22, 19 January 2011 (UTC)