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