@@ -198,58 +198,6 @@ private static IEnumerable<IBinaryTree<T>> AsLevelOrderEnumerableIterator<T>(IBi
198198 /// Represents a binary node of a <see cref="BinaryTree{T}"/>.
199199 /// </summary>
200200 /// <typeparam name="T">The type of value the node contains.</typeparam>
201- /// <example>
202- /// This is an example to instantiatea binary tree with its pre and in order.
203- /// <code language="C#"><![CDATA[
204- /// static BinaryTree<int> tree;
205- /// static BinaryTree<int> current;
206- /// static void Main(string[] args)
207- /// {
208- /// tree = new BinaryTree<int>();
209- /// Console.WriteLine("Please enter the values by pre order, splited by space:");
210- /// int[] front = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
211- /// Console.WriteLine("Please enter the values by in order, splited by space:");
212- /// int[] mid = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
213- /// if (front.Length != mid.Length)
214- /// {
215- /// Console.WriteLine("The length of the two arrays should be equal.");
216- /// return;
217- /// }
218- /// tree.LeftChild = null;
219- /// tree.RightChild = null;
220- /// current = tree;
221- /// Create(front, mid);
222- /// Console.WriteLine("The post order of this tree is:");
223- /// Console.WriteLine(String.Join(" ", tree.AsPostOrderEnumerable().Select(node => node.ToString()).ToArray()));
224- /// Console.WriteLine("The level order of this tree is:");
225- /// Console.WriteLine(string.Join(" ", tree.AsLevelOrderEnumerable().Select(node => node.ToString()).ToArray()));
226- /// }
227- /// static void Create(in Span<int> front, in Span<int> mid)
228- /// {
229- /// int n = front.Length;
230- /// BinaryNode<int> tr = current;
231- /// tr.Value = front[0];
232- /// int i;
233- /// for (i = 0; i < n; i++)
234- /// {
235- /// if (mid[i] == front[0])
236- /// {
237- /// break;
238- /// }
239- /// }
240- /// if (i > 0)
241- /// {
242- /// current = (tr.LeftChild = new BinaryTree<int>());
243- /// Create(front.Slice(1, i), mid);
244- /// }
245- /// if (n - 1 - i > 0)
246- /// {
247- /// current = (tr.RightChild = new BinaryTree<int>());
248- /// Create(front.Slice(i + 1, n - 1 - i), mid.Slice(i + 1, n - 1 - i));
249- /// }
250- /// }
251- /// ]]></code>
252- /// </example>
253201 public class BinaryTree < T > : IBinaryTree < T >
254202 {
255203 private T _value ;
0 commit comments