基数排序浮动数据 [英] Radix Sort Floating Data
问题描述
基数如何排序浮点数据?例如12.4,45.13等,它会先读取小数点的右边吗?还是先读小数点的左边?然后如果读到小数点的右边,它将如何处理数字它首先阅读最右边的第一个?
http://codercorner.com/RadixSortRevisited.htm
基本上,计算机以特定的格式存储浮点数。他们不把它写成45.13。因此,这样思考就不会涉及到它的实际工作方式。
忽略这一点,基数排序必须首先考虑最重要的部分。在一个浮点数,它是最左边的数字。基本上,我们将填充所有的数字在小数点前有相同的位数。然后我们从左到右读取数字。
How does radix sorts float data? for example 12.4, 45.13 etc. would it read the right side of the decimal point first?or the left side of the decimal point first?And then if it read the right side of the decimal point, how would it treat the numbers, would it first read the rightmost first?
See this page of a discussion of it.
http://codercorner.com/RadixSortRevisited.htm
Basically, computers store the floating point in a particular format. They do not write it out as 45.13. As a result, thinking about it that way won't relate to how it actually works.
Ignoring that, Radix sort has to look at the most significant part first. In a floating point number that it the left most digits. Essentially, we'd pad all the numbers to have the same number of digits before the decimal point. Then we'd read the digits left to right.
这篇关于基数排序浮动数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!