Sort By Double

简介:

I have wrote a article which describes how to deal with a complicate data structure “sortable tree”. See here.

As i said, it is so complicate that cann’t be maintain easily.

 

Now, i have found a new fluent way to sort this tree:”Sorting by Double”.

“Sorting by double “ is more convinient than int, because we could always insert a new number in any two double values. For example:

we can insert 0.5 into 0 and 1.

we can insert 0.25 into 0 and 0.5.

0.0125 between 0 and 0.25.

:)

 

The benefit of this design is that you don’t have to reset the sorting value of old nodes.

 

 

Reference:

层次结构的数据库处理(译文)

Storing Hierarchical Data in a Database
目录
相关文章
List strem sum
List strem sum
38 0
C#基础③——类型转换(int转double、double转int、Convert)
不同数据类型间的转换,如:将int类型转换为string类型
|
11月前
|
机器学习/深度学习
计算sum=1+2...+n,要求number和sum的类型都是int,且sum在32位以内~
计算sum=1+2...+n,要求number和sum的类型都是int,且sum在32位以内~
对int,char,float,double进行求和操作
对int,char,float,double进行求和操作
153 0
|
关系型数据库
PG:INT4 VS. FLOAT4 VS. NUMERIC
PG:INT4 VS. FLOAT4 VS. NUMERIC
129 0
LeetCode 307. Range Sum Query - Mutable
update(i, val) 函数可以通过将下标为 i 的数值更新为 val,从而对数列进行修改。
96 0
LeetCode 307. Range Sum Query - Mutable
|
存储
7. Reverse Integer
7. Reverse Integer
83 0
LeetCode之Two Sum II - Input array is sorted
LeetCode之Two Sum II - Input array is sorted
94 0
成功解决ValueError: min_samples_split must be an integer greater than 1 or a float in (0.0, 1.0]; got th
成功解决ValueError: min_samples_split must be an integer greater than 1 or a float in (0.0, 1.0]; got th