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

}

}



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 连州市| 晴隆县| 阿克陶县| 宁城县| 静乐县| 平遥县| 邻水| 淅川县| 徐汇区| 金川县| 昌图县| 翁牛特旗| 贵溪市| 达日县| 彭山县| 北辰区| 渑池县| 嵊州市| 尼玛县| 许昌县| 昌平区| 岑巩县| 密山市| 武川县| 浦北县| 南江县| 会东县| 休宁县| 改则县| 江都市| 乳山市| 五华县| 宁强县| 龙胜| 游戏| 石台县| 麻栗坡县| 原平市| 古蔺县| 闻喜县| 乐平市|