数据结构

位置:IT落伍者 >> 数据结构 >> 浏览文章

数据结构与算法


发布日期:2018年09月02日
 
数据结构与算法

广义树和基本树的主要区别就是有任意的度

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;

}

}

               

上一篇:如何学习数据结构[4]

下一篇:经典的用户权限管理数据结构分析设计