The & 0xFF operation of the radix sort is the analog of the > operation in other sorts... no it''s not a comparison - but it''s not a fair comparison to measure a sort''s effectiveness solely by comparisons!
What are the reads/writes/compares for a merge sort?
Merge Sort - efficiancy crushed by recursion?
quote:Original post by Beer Hunter
By that logic, you could say that adding or subtracting numbers is a comparison.
If you consider the disassembly they're not all that different...
Actually, I say that a subtraction is _more like a comparison than & is
a jnz instead of a mov
Edited by - Magmai Kai Holmlor on January 1, 2002 7:32:06 PM
Hmmm. An array of 16 bins. I do declare, I''ve just overflowed. I meant, of course, 256 bins.
"The & 0xFF operation of the radix sort is the analog of the > operation in other sorts..."
What if you use a 32-bit radix?
"no it's not a comparison - but it's not a fair comparison to measure a sort's effectiveness solely by comparisons!"
Exactly!
But that doesn't mean you should hallucinate new meanings for "comparison". It means you should be measuring other things (reads and writes) as well!
How many reads and writes are used by the merge sort? I counted them and got 39,902,848 reads and the same number of writes <edit>for a 1,000,000 element array</edit>. For the record, 2 * 1,000,000 * log2 1,000,000 = 39,863,137 (rounded)... that's less than 0.1% off.
Edited by - Beer Hunter on January 2, 2002 7:12:14 PM
What if you use a 32-bit radix?
"no it's not a comparison - but it's not a fair comparison to measure a sort's effectiveness solely by comparisons!"
Exactly!
But that doesn't mean you should hallucinate new meanings for "comparison". It means you should be measuring other things (reads and writes) as well!
How many reads and writes are used by the merge sort? I counted them and got 39,902,848 reads and the same number of writes <edit>for a 1,000,000 element array</edit>. For the record, 2 * 1,000,000 * log2 1,000,000 = 39,863,137 (rounded)... that's less than 0.1% off.
Edited by - Beer Hunter on January 2, 2002 7:12:14 PM
I said it was _like_ a comparison
Is it feasible to devise a radix sort for floating point types?
Is it feasible to devise a radix sort for floating point types?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement