コード例 #1
0
        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);
        }
コード例 #2
0
 public BinarySearchTree(Comparer <TKey> customComparer)
 {
     root     = null;
     Count    = 0;
     comparer = customComparer;
 }
コード例 #3
0
 public BinarySearchTree()
 {
     root     = null;
     Count    = 0;
     comparer = Comparer <TKey> .Default;
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinarySearchTree{TKey}"/> class.
 /// </summary>
 public BinarySearchTree()
 {
     root  = null;
     Count = 0;
 }