即重新present树对象(Objects that represent trees)

   IT问题网   2019-08-13 00:00:00

问 题

有没有在c#中的任何对象(或.net)的重新presents二叉树(或好奇)和正叉树?

我说的不是presentation树形控件,但作为模型对象。

如果不是,请问有什么好的外部实现?

解决方案

在 ngenerics 项目是数据结构和算法的真棒集合包括二叉树。

 公共类二叉树 t :ivisitablecollection t&gt ;, itree t
{
//方法
公共无效添加(二叉树 t子树);
公共虚拟无效breadthfirsttraversal(ivisitor t游客);
公共虚拟无效
depthfirsttraversal(orderedvisitor t orderedvisitor);
公共二叉树 t getchild(int指数);
公共bool删除(二叉树 t儿童);
公共虚拟无效removeleft();
公共虚拟无效removeright();

// ...

//属性
公共虚拟t个数据{获得;组; }
公众诠释学位{获得; }
公共虚拟int高度{获得; }
公共虚拟bool isleafnode {获得; }
公共二叉树 t这[int i] {获得; }
公共虚拟二叉树 t左{获得;组; }
公共虚拟二叉树 t右{获得;组; }

// ...
}
 

标签:重新从新对象



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

.NET:是否有可能得到的HttpWebRequest自动DECOM preSS gzip压缩的反应?(.NET: Is it possible to get HttpWebRequest to automatically decompress gzip'd responses)

problem in this answer, i described how i resorted to wra ...

如何检查是否一个程序正在使用.NET?(How to check if a program is using .NET)

problem can we check if a running application or a progra ...

使用Visual Studio安装项目以自动注册和GAC一个COM互操作DLL(Use Visual Studio Setup Project to automatically register and GAC a COM Interop DLL)

problem i've created a .net assembly for com interop and ...

如何获得MX记录与System.Net.DNS DNS名称?(How to get mx records for a dns name with System.Net.DNS)

problem is there any built in method in the .net library ...

我为什么要preFER单曲“等待Task.WhenAll”在多个等待着?(Why should I prefer single 'await Task.WhenAll' over multiple awaits)

problem in case i don't care about the order ...

我该如何分析和转换日期时间的到RFC 822的日期,时间格式?(How do I parse and convert DateTime’s to the RFC 822 date-time format)

problem how do i convert a datetime structure to its equi ...

有什么区别呢.AsNoTracking()做什么呢?(What difference does .AsNoTracking() make)

problem i have a question regarding the .asnotracking() e ...

实体框架/ LINQ到SQL:跳过和放大器;采取(Entity Framework/Linq to SQL: Skip & Take)

problem just curious as to how skip amp; take are suppose ...

StreamWriter.Flush()和StreamWriter.Close()之间的区别是什么?(What is the difference between StreamWriter.Flush() and StreamWriter.Close())

problem what is the difference in functionality between s ...

现净switch语句散列或索引?(Are .Net switch statements hashed or indexed)

problem does .net 4 (or any prior version) perform any so ...

使用LINQ生成没有选择直接更新(Use linq to generate direct update without select)

problem g'day everyone. i'm still learning l ...

是否有可能拦截控制台输出?(Is it possible to intercept Console output)

problem i call a method, say, fizzbuzz(), over which i ha ...

当使用排序列表 TKEY的,TValue在一个SortedDictionary TKEY的,TValue?(When to use a SortedList<TKey, TValue> over a SortedDictionary<TKey, TValue>)

problem this may appear to be a duplicate of this questio ...

如何初始化列表 T给定的尺寸(相对于容量)?(How to initialize a List<T> to a given size (as opposed to capacity))

problem .net offers a generic list container whose perfor ...

如何使用XPath用的XDocument?(how to use XPath with XDocument)

problem there is a similar question, but it seems that th ...

什么是WebConfigurationManager和ConfigurationManager中的区别?(What's the difference between the WebConfigurationManager and the ConfigurationManager)

problem what's the difference between the webconfiguratio ...

NUnit的测试运行秩序(NUnit Test Run Order)

problem by default nunit tests run alphabetic ...

如何恢复从C#数据库(How to restore a database from C#)

problem i have a sql 2008 db. i am running a form that ba ...

调用堆栈不说"你来自哪里"但是"你要去哪里,下一个"?(The call stack does not say "where you came from", but "where you are going next")

problem in a previous question (get object ca ...

如何读取和写入ID3标签在C#中的MP3?(How to read and write ID3 tags to an MP3 in C#)

problem is there a library for reading and writing id3 ta ...