项目作者: ZoraizQ

项目描述 :
B+ Tree Implementation (Search, Insert, Remove)
高级语言: C++
项目地址: git://github.com/ZoraizQ/bplus-tree.git
创建时间: 2019-11-29T06:02:24Z
项目社区:https://github.com/ZoraizQ/bplus-tree

开源协议:

下载


BPlus-Tree

A B+ tree of degree ​ m ​ is a balanced tree in which each node can hold a maximum of ​ m ​ keys
and ​ m+1​ pointers​.

BPlusTree

Helper functions created: split(), borrow(), borrowChildren(), addKey(), deleteKey(), mergeWithParent()

Functions:

Create a tree:

  1. BPlusTree tree ( 3 ); // creating a tree of degree 3
  2. tree.insert(​ 5 ); //inserting a key
  3. tree.insert(​ 10 );
  4. tree.insert(​ 14 );
  5. tree.insert(​ 32 );
  6. tree.insert(​ 9 );
  7. tree.insert(​ 21 );
  8. tree.insert(​ 1 );
  9. tree.insert(​ 11 );
  10. tree.insert(​ 15 );
  11. tree.insert(​ 16 );

Display tree:

  1. tree.display();
  2. // {15}​ ​ {9}{11}​ ​ {1}{5}​ ​ {9}{10}​ ​ {11}{14}​ ​ {21}​ ​ {15}{16}​ ​ {21}{32}

Search a key:

  1. tree.search(5); //returns Node* if found else null

Remove a key:

  1. tree.remove(5); //removes Node containing the key 5