Tag: 多路树

如何实现非二叉树

我在实现非二叉树时遇到问题,其中根节点可以具有任意数量的子节点。 基本上,我想了解一下如何使用它的一些想法,因为我确实编写了一些代码,但我仍然坚持下一步该做什么。 顺便说一句,我根本不能使用任何集合类。 我只能使用系统。 using System; namespace alternate_solution { // [root] // / / \ \ // text text text text class Node//not of type TreeNode (since Node is different from TreeNode) { public string data; public Node child; public Node(string data) { this.data = data; this.child = null; } } }