国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

數據結構與算法(C#實現)系列---廣義樹(一)

2019-11-18 19:43:24
字體:
來源:轉載
供稿:網友

數據結構與算法(C#實現)系列---廣義樹(一)

Heavenkiller(原創)

廣義樹和基本樹的主要區別就是有任意的度

using System;
using System.Collections;
namespace DataStructure

{
     /// <summary>

     /// GeneralTree 的摘要說明。

     /// general tree is a tree which has a arbitrary degree and no empty tree

     /// use ArrayList to replace ListAsLinkedList

     /// </summary>

     public class GeneralTree:Tree

     {

         PRotected object key=null;

         protected uint degree=0;

         //protected uint height=0;

 

         protected ArrayList treeList=new ArrayList();

 

         public GeneralTree(object _objKey)

         {

              //

              // TODO: 在此處添加構造函數邏輯

              //

 

              key=_objKey;

              degree=0;

         //   height=0;

              ArrayList treeList=new ArrayList();

         }

 

         public virtual void AttackSubtree(GeneralTree _gTree)

         {

              this.treeList.Add(_gTree);

              ++degree;

         }

         public virtual GeneralTree DetachSubtree(GeneralTree _gTree)

         {

             

              this.treeList.Remove(_gTree);

              degree--;

             

              return _gTree;//?????  how to remove ,reference or object????

         }

 

         public override Tree this[uint _index]

         {

              get

              {

                   if(_index>=this.degree)

                       throw new Exception("my:out of index");

                   return (Tree)treeList[(int)_index];

              }

              set

              {
                   treeList[(int)_index]=value;

              }
         }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 芜湖县| 灵寿县| 尖扎县| 青岛市| 印江| 高唐县| 卓尼县| 镇平县| 防城港市| 赤峰市| 永安市| 新化县| 凌云县| 西平县| 崇仁县| 赣州市| 常山县| 乐亭县| 天祝| 楚雄市| 武城县| 济宁市| 辽宁省| 武定县| 军事| 尖扎县| 辽中县| 浦城县| 壤塘县| 霸州市| 乳山市| 平乐县| 邢台市| 涞水县| 宜都市| 麻栗坡县| 醴陵市| 项城市| 安庆市| 米林县| 贵溪市|