国产探花免费观看_亚洲丰满少妇自慰呻吟_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;

              }
         }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新蔡县| 厦门市| 吴川市| 日土县| 东海县| 锡林浩特市| 泸定县| 封丘县| 武冈市| 乡宁县| 卓尼县| 布尔津县| 三亚市| 山阴县| 雷州市| 招远市| 邹平县| 长沙市| 会昌县| 哈尔滨市| 昌图县| 淅川县| 万州区| 文成县| 紫阳县| 玉林市| 阜宁县| 厦门市| 扬州市| 卫辉市| 石狮市| 天柱县| 都兰县| 当雄县| 陆良县| 临清市| 天水市| 通许县| 分宜县| 布拖县| 望城县|