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

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

數據結構與算法(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;

         }

     }

}

 




主站蜘蛛池模板: 午夜在线观看免费观看大全 | 日韩中文字幕高清在线专区 | 一级黄色大片视频 | 日韩亚洲欧美综合一区二区三区 | 三级在线观看国产 | 五月婷婷丁香六月 | 日韩在线视 | 特级毛片全部免费播放a一级 | 日韩午夜片 | 视频一区二区精品的福利 | 性亚洲无删减 | 欧美在线视频观看 | 青草影院在线 | 日韩综合nv一区二区在线观看 | 亚洲天堂精品在线观看 | 欧美视频在线观看xxxx | 伊人影院2019 | 日本欧美黄色 | 一区二区三区在线播放视频 | 亚洲免费网站在线观看 | 亚洲第三区 | 速度与激情9完整版免费观看 | 日韩在线精品视频 | 亚洲欧美一区二区三区二厂 | 午夜老司机永久免费看片 | 色花堂国产精品首页第一页 | 亚洲性色视频 | 日本黄色免费网址 | 欧美网站在线观看 | 青青草原影院 | 中文字幕字幕乱码熟 | 日本欧美中文字幕 | 青草久草视频 | 亚洲欧美日韩在线中文一 | 日日夜夜天天久久 | 午夜在线亚洲 | 四虎影院在线网址 | 色综合天天综久久久噜噜噜久久〔 | 人碰人操 | 婷婷丁香综合 | 色综合久久98天天综合 |