开发者

What's the insert complexity of btree?

开发者 https://www.devze.com 2023-04-01 05:54 出处:网络
It seems when new node is inserted(whose complexity is O(logN)), the whole tree needs to be r开发者_如何学Pythone-balanced.

It seems when new node is inserted(whose complexity is O(logN)), the whole tree needs to be r开发者_如何学Pythone-balanced.

What's the complexity of re-balancing?


It's the height of the tree. It's not rebalanced in the sense of a binary tree. When you add a node, if that causes a split you insert a key into the node above. If that causes as split, then you do the same thing one level up, etc., until you get to the root. So the complexity is O(logN).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号