动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C#教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ C#教程 ]的信息



本月文章推荐
.C#中的“装箱”(boxing)与“拆.
.数据结构与算法(C#实现)系列---广.
.C# 2.0中泛型编程初级入门教程.
.C#中结构与类的区别.
.c#时间增加并对比做法.
.基于C#的接口基础教程之一.
.SUNWEN教程之----C#进阶(五).
.C#语言初级入门(1).
.数据结构与算法(C#实现)系列---树.
.C# 中的类型转换.
.SUNWEN教程之----C#进阶(九).
.数据结构与算法(C#实现)系列---N.
.C#中的数组和C++中数组的区别.
.SUNWEN教程之----C#进阶(十).
.数据结构与算法(C#实现)系列---演.
.数据结构与算法(C#实现)系列---广.
.C#学习笔记(4).
.C#,深入浅出全接触(二).
.数据结构与算法(C#实现)系列---演.
.C#的多线程机制初探(4).

数据结构与算法(C#实现)系列---N叉树(一)

发表日期:2004-2-7 |


数据结构与算法(C#实现)系列---N叉树(一)

Heavenkiller(原创)

N叉树的每一节点度数都相同,为N
using System;
using System.Collections;
namespace DataStructure

{

     /// <summary>

     /// NaryTree 的摘要说明。-----N叉树

     /// </summary>

     public class NaryTree:Tree

     {

         // member variables

         protected object key;

         protected uint degree;

         protected ArrayList treeList=new ArrayList();

         //protected uint height=0;//暂时默认为0

 

         //create an empty tree whose attribute of degree is _degree

         public NaryTree(uint _degree)

         {

              //

              // TODO: 在此处添加构造函数逻辑

              //

              this.key=null;

              this.degree=_degree;

              this.treeList=null;

         }

         //构造一棵叶子结点的N叉树

         public NaryTree(uint _degree,object _key)

         {

              this.key=_key;

              this.degree=_degree;

              this.treeList=new ArrayList();

              this.treeList.Capacity=(int)_degree;

 

              for(int i=0;i<this.treeList.Capacity;i++)

              {

                  

                   this.treeList.Add( this.GetEmptyInstance(_degree) );

              }

         }

         //-----------------------------------------------------------------

         protected virtual object GetEmptyInstance(uint _degree)

         {    return new NaryTree(_degree); }

         //-------------------------------------------------------------------

         //judge whether the tree is an empty tree

         public override bool IsEmpty()

         {    return this.key==null; }

         //判定是否是叶子结点。如果即不是空树且每一棵子树均为空树,则为叶子结点

         public override bool IsLeaf()

         {

              if(IsEmpty())

                   return false;

              for(uint i=0;i<this.degree;i++)

              {

                   if(  !(this[i].IsEmpty()) )

                       return false;

              }

              return true;

         }

         //-----------------------------------Inherited Attributes---------------------------------

         public override object Key

         {

              get

              {

                   return this.key;

              }

         }

         //索引器

         public override Tree this[uint _index]

         {

              get

              {

                  

                   if( _index>=this.degree )

                       throw new Exception("My:out of index!");//如果出界,则抛出异常

                   if( this.IsEmpty() )

                       return null;//如果是空树,则索引器返回一个 null

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

              }

              set

              {

                   this.treeList[(int)_index]=value;

              }

         }

上一篇:数据结构与算法(C#实现)系列---广义树(二) 人气:15532
下一篇:数据结构与算法(C#实现)系列---N叉树(二) 人气:20142
浏览全部数据结构与算法(C#实现)的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-19 Roclog v3.1.4 SP1
2008-7-19 马克斯CMS(Maxcms) v1.1 Build 0
2008-7-19 乐学LBBS无限级目录图片直读系统
2008-7-19 PHP在线考试系统PPExam v1.2.5
2008-7-19 APJE私服发布系统 v2.0
2008-7-19 寻觅图书管理系统 v1.12
2008-7-19 寻觅学校管理系统
2008-7-19 义乌网站目录baidu新闻订阅 v1.0
2008-7-19 牛仔IIS日志蜘蛛爬行记录分析器
2008-7-19 UltraEdit 简体中文增强版 14.10
2008-7-19 CentOS 5.2 i386 LiveCD
2008-7-19 Snapture多功能相机 v1.4
2008-7-19 iAcces中文输入法 v1.0Build016
2008-7-19 Cookbook烹饪秘籍 v2.5
2008-7-19 苹果专用DVD转换工具 v1.1.59汉化
2008-7-19 Modem修复软件ZiPhone修改版04.0
2008-7-19 AgileMessenger即时通讯工具美化
2008-7-19 Sketches画图软件 v0.7b6破解版


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵