Talk:Sorting algorithms/Radix sort: Difference between revisions

From Rosetta Code
Content added Content deleted
m (signatures)
(How to solve)
Line 1: Line 1:
==Negatives==
Beware negative number handling! See [http://codepad.org/MLi6H7Y1 Wiki's python demo].
Beware negative number handling! See [http://codepad.org/MLi6H7Y1 Wiki's python demo].
<div><small>''(This was written by [[User:Dingowolf|Dingowolf]] ([[User_talk:Dingowolf|Talk]] | [[Special:Contributions/Dingowolf|contribs]]) at 13:03, 19 January 2011)''</small></div>
<div><small>''(This was written by [[User:Dingowolf|Dingowolf]] ([[User_talk:Dingowolf|Talk]] | [[Special:Contributions/Dingowolf|contribs]]) at 13:03, 19 January 2011)''</small></div>
: 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.) –[[User:Dkf|Donal Fellows]] 13:22, 19 January 2011 (UTC)

Revision as of 13:22, 19 January 2011

Negatives

Beware negative number handling! See Wiki's python demo.

(This was written by Dingowolf (Talk | contribs) at 13:03, 19 January 2011)
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)