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

首頁 > 開發 > 綜合 > 正文

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

2024-07-21 02:19:58
字體:
來源:轉載
供稿:網友


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

}

}



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 房产| 隆德县| 米泉市| 禄丰县| 土默特左旗| 云霄县| 博客| 南康市| 平安县| 和龙市| 漳浦县| 郴州市| 白朗县| 佛冈县| 蒙阴县| 东至县| 镇宁| 台山市| 无为县| 滦南县| 溧阳市| 蕉岭县| 呼玛县| 儋州市| 札达县| 那曲县| 赤峰市| 岢岚县| 仪征市| 巨野县| 田阳县| 会同县| 霍山县| 仁布县| 上高县| 和田市| 马龙县| 清河县| 绥中县| 娄底市| 林西县|