【发布时间】:2014-09-03 01:26:50
【问题描述】:
我真的很感激 2-3-4 树的澄清...假设您有这样定义的树:
class N234{ //node class
public:
int firstData, secondData, thirdData;
N234 *firstChild,*secondChild,*thirdChild,*fourthChild,*parent;
};
class T234{ //tree with root node
public:
T234(){
this->root->parent=NULL;
this->root->firstChild=NULL;
this->root->secondChild=NULL;
this->root->thirdChild=NULL;
this->root->fourthChild=NULL;
}
private:
N234* root;
};
我的问题实际上是当它的变量(firstData,secondData,thirdData)已经有一些值时,我怎么知道节点是否已满(其中包含所有三个值)?
例如:
根:|4|根的左孩子:|1,2|
根|7,9|的右孩子
这里的根有一个值 (4)。我的问题是我们怎么知道它实际上有一个值,因为他所有的其他变量(secondData,thirdData)都有一些值(即使它是垃圾)..提前谢谢!
【问题讨论】:
标签: c++ data-structures 2-3-4-tree