六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

數據結構與算法(C#完成)系列---N叉樹(二)

[摘要]數據結構與算法(C#實現)系列---N叉樹(二)Heavenkiller(原創)public override uint Degree get return this.degree; ...

數據結構與算法(C#實現)系列---N叉樹(二)

Heavenkiller(原創)

public override uint Degree

         {

              get

              {

                   return this.degree;

              }

         }
                     

         //只用于空樹結點

         public virtual void AttachKey(object _obj)

         {

              if(!IsEmpty())

                   throw new Exception("My:this node must be a empty tree node!");

              this.key=_obj;

              this.treeList=new ArrayList();//產生一個degree長的數組,并將其初始化為空樹

              this.treeList.Capacity=(int)this.degree;

 

              for(int i=0;i<this.degree;i++)

              {

                   treeList.Add(new NaryTree(this.degree));

              }

              /*

              foreach(object tmpObj in this.treeList)

              {

                   tmpObj=new NaryTree(this.degree);

              }

              */

         }

         //只用于葉子結點,將葉子結點變為一個空結點,并返回葉子結點關鍵字的引用

         public virtual object DetachKey()

         {

              if(!IsLeaf())

                   throw new Exception("My:this node must be a leaf node!");

              object result=this.key;//store this leaf node temporary

              this.key=null;

              this.treeList=null;

 

              return result;

         }

         //將子樹連接到指定樹的第num個結點上,前提是這個結點必須是空結點,并且度數相同,否則拋出異常

         public virtual void AttachSubtree(uint num,NaryTree _naryTree)

         {

              if(this.IsEmpty())

                   throw new Exception("My:it can't be a empty tree!");

              if(!(this[num-1].IsEmpty()) this.degree!=_naryTree.degree )

                   throw new Exception("My:this[i-1] must be empty and they should have the same degree!");

              this[num-1]=_naryTree;

         }

         //僅為非空樹定義,從給定樹中刪去它的第i棵子樹并連上一個空樹,度數相同,并且返回刪除的子樹引用

         public virtual NaryTree DetachSubtree(uint num)

         {

              if (IsEmpty())

                   throw new Exception("My:it can't be empty! ");

              NaryTree tmpTree=this;

              ((NaryTree)this[num-1]).key=null;

              ((NaryTree)this[num-1]).treeList=null;

 

              return this;

         }

     }

}

 




主站蜘蛛池模板: 五月综合色 | 日韩 亚洲 翔田千里 在线 | 天天躁夜夜躁很很躁麻豆 | 欧美整片在线 | 亚洲第一成网站 | 四虎影视免费在线观看 | 最近最中文字幕视频 | 四虎永久在线精品视频免费观看 | 色综合天天综合网国产成人网 | 欧美一级久久久久久久大片 | 欧美一二三区 | 日本国产欧美 | 伊人影视网 | 清清草免费视频 | 午夜三级国产精品理论三级 | 青草园网站在线观看 | 天天干夜操 | 日日干夜夜操视频 | 日本精品高清一区二区2021 | 欧美性活生活视频 | 酥酥影院一级毛片在线看 | 四虎精品福利视频精品 | 日本视频在线 | 色综合久久天天综合观看 | 欧美一区二区三区男人的天堂 | 日本在线免费观看 | 三级国产在线观看 | 天堂资源在线最新版 | 亚洲欧美另类精品久久久 | 淫片a武则天 | 午夜影院亚洲 | 欧美中文在线观看 | 亚洲成a人片在线观看精品 亚洲成a人片在线观看导航 | 欧美一级做一a做片性视频 欧美一级做性受 | 色偷偷亚洲女人天堂观看欧 | 性生大片一级毛片免费观看 | 亚洲成人av| 欧美一区二区三区婷婷月色 | 日本高清无卡码一区二区久久 | 天天做天天爱天天一爽一毛片 | 日本tv欧美tv天堂 |