update tree

This commit is contained in:
ranwenjie
2021-04-29 14:03:46 +08:00
parent 7d1e2970a6
commit 2632ed08c3
6 changed files with 119 additions and 7 deletions
+64
View File
@@ -14,3 +14,67 @@
5. 有k个关键字的页节点包含k+1个孩子
也就是说:`根节点到每个叶节点的路径长度都是相同的。`
## 数据结构
```
typedef struct Item{
int key;
Data data;
}
#define m 3 //B树的阶
typedef struct BTNode{
int degree; //B树的度
int keynums; //每个节点key的个数
Item items[m];
struct BTNode *p[m];
}BTNode,* BTree;
typedef struct{
BTNode *pt; //指向找到的节点
int i; // 节点中关键字的序号 (0,m-1)
int tag; //1:查找成功,0:查找失败
}Result;
Status btree_insert(root,target)//插入B树节点
Result btree_find(root,target)//查找B树节点
Status btree_delete(root,target)//删除B树节点
```
## 插入B树节点
## 查找B树节点
## 删除B树节点