Basic


B+树和B树类似(有关B树:http://www.cnblogs.com/YuNanlong/p/6354029.html,区别主要在于叶节点,如果在父节点的Child数组中指向某一叶节点指针的下标为Index,则该叶节点中的最大数据值与其父节点中Key[Index]的值相等,并且除最右侧的叶节点之外所有叶节点都有一个指针指向其右边的兄弟节点,因此所有非叶节点中数据值都在叶节点中有相同的值与之对应。

下面是一些声明和定义:

typedef int ElementType;typedef int* PtrElementType;typedef enum Bool BoolType;enum Bool{
    False = 0,
    True = 1};typedef struct TreeNode *PtrBpNode;typedef struct TreeNode BpNode;struct TreeNode{    int Num;
    BoolType IsLeaf;
    PtrElementType Key;
    PtrBpNode *Child;
    PtrBpNode Next;
};typedef struct Tree *PtrBp;struct Tree{
    PtrBpNode Root;
};void ShiftKey(Pt
        
		

网友评论