Sort By Double

本文介绍了一种新的排序方法——双倍排序,它通过使用双精度浮点数来实现更灵活的数据结构排序,相较于整数,这种方法允许在任意两个双精度数之间插入新数,从而简化了对复杂数据结构的维护。此设计的一大优势在于无需重新设置旧节点的排序值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值