广义树和基本树的主要区别就是有任意的度
usingSystem;
usingSystemCollections;
namespaceDataStructure{
///<summary>
///GeneralTree的摘要说明
///generaltreeisatreewhichhasaarbitrarydegreeandnoemptytree
///useArrayListtoreplaceListAsLinkedList
///</summary>
publicclassGeneralTree:Tree{
protectedobjectkey=null;protecteduintdegree=;
//protecteduintheight=;
protectedArrayListtreeList=newArrayList();
publicGeneralTree(object_objKey){
//
//TODO:在此处添加构造函数逻辑
//
key=_objKey;
degree=;
//
height=;
ArrayListtreeList=newArrayList();
}
publicvirtualvoidAttackSubtree(GeneralTree_gTree){
thistreeListAdd(_gTree);
++degree;
}
publicvirtualGeneralTreeDetachSubtree(GeneralTree_gTree){
thistreeListRemove(_gTree);
degree;
return_gTree;
//?????howtoremovereferenceorobject????
}
publicoverrideTreethis[uint_index]
{
get
{
if(_index>=thisdegree)
thrownewException(my:outofindex);
return(Tree)treeList[(int)_index];
}
set
{
treeList[(int)_index]=value;
}
}