private IEnumerable <T> Inorder(BinarySearchTreeNode <T> node) { var nodes = new List <T>(); if (node != null) { if (node.Left != null) { nodes.AddRange(Inorder(node.Left)); } nodes.Add(node.Value); if (node.Right != null) { nodes.AddRange(Inorder(node.Right)); } } return(nodes); }
public BinarySearchTree(Comparer <TKey> customComparer) { root = null; Count = 0; comparer = customComparer; }
public BinarySearchTree() { root = null; Count = 0; comparer = Comparer <TKey> .Default; }
/// <summary> /// Initializes a new instance of the <see cref="BinarySearchTree{TKey}"/> class. /// </summary> public BinarySearchTree() { root = null; Count = 0; }