Improving scalability of the modified preorder tree traversal algorithm

后端 未结 3 740
星月不相逢
星月不相逢 2021-02-01 10:23

I\'ve been thinking about the modified preorder tree traversal algorithm for storing trees within a flat table (such as SQL).

One property I dislike about the standard a

3条回答
  •  醉酒成梦
    2021-02-01 10:52

    I think you're better off looking at a different way of storing trees. If your tree is broad but not terribly deep (which seems likely for the case you suggested), you can store the complete list of ancestors up to the root against each node. That way, modifying a node doesn't require touching any nodes other than the node being modified.

提交回复
热议问题