Algorithm to find k-th key in a B-tree?

后端 未结 3 1305
[愿得一人]
[愿得一人] 2020-12-18 15:22

I\'m trying to understand how I should think about getting the k-th key/element in a B-tree. Even if it\'s steps instead of code, it will still help a lot. Thanks

Ed

3条回答
  •  死守一世寂寞
    2020-12-18 16:07

    You can use a new balanced binary search tree(like Splay or just using std::set) to record what elements are currently in the B-Tree. This will allow every operation to finish in O(logn), and its quite easy to implement(when using std::set) but will double the space cost.

提交回复
热议问题