© 2026 Hedgehog Software, LLC
Node<T>
Something is wrong in our systems, your code took too long to execute.
public class Node<T> { public T value; public Node<T> left, right, parent; public Node(T value) { this.value = value; } public Node(T value, Node<T> left, Node<T> right) { this.value = value; this.left = left; this.right = right; left.parent = right.parent = this; } public IEnumerable<T> PreOrder { get { return new PreOrderIterator<T>(this); } } } public class PreOrderIterator<T> : IEnumerable<T> { private Stack<Node<T>> stack = new Stack<Node<T>>(); public PreOrderIterator(Node<T> root) { stack.Push(root); } public IEnumerator<T> GetEnumerator() { return GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } }