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

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

數據結構與算法(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女人刺激视频免费 | 日韩第一页在线观看 | 中文字幕亚洲第一 | 日本乱人伦片中文字幕三区 | 雪白丰满丝袜长腿白嫩在线 | 日日碰日日摸日日澡视频播放 | 青青青青青青在线精品视频 | 日韩成人毛片高清视频免费看 | 手机在线观看国产精选免费 | 一级做a爰片性色毛片思念网 | 天天综合久久久网 | 日本无卡码一区二区三区 | 一二三四在线观看免费高清观看 | 日本中文字幕在线视频站 | 色综合综合 | 亚洲网站色 | 午夜影院在线观看 | 伊人精品视频 | 日韩福利在线 | 天天射天天干天天操 | 四虎在线永久免费视频网站 | 一区二区视频在线播放 | 在线国产一区二区 | 色噜噜在线观看 | 天天欲色成人综合网站 | 一道本在线 | 色老大综合久久综合热 | 色爱综合区 | 色人在线 | 日韩黄色一级片 | 日本成人免费 | 日韩性插 | 中文字幕在线网址 | 四虎影剧院 | 先锋资源色 | 亚洲免费三级 | 青草视频免费看 | 日本高清免费在线观看 | 中文字幕免费人成乱码中国 |