Beispiel #1
0
        private static void Main(string[] args)
        {
            var tree   = new RedBlackTree <int>();
            var random = new Random();

            for (var i = 0; i < 10; i++)
            {
                tree.Insert(random.Next(0, 100));
            }
        }
 /// <summary>
 /// Add a new value.
 /// Time complexity: O(log(n)).
 /// </summary>
 /// <param name="value">The value to add.</param>
 public void Add(T value)
 {
     binarySearchTree.Insert(value);
 }
Beispiel #3
0
 /// <summary>
 /// Add a new value for given key.
 /// Time complexity: O(log(n)).
 /// </summary>
 public void Add(K key, V value)
 {
     binarySearchTree.Insert(new SortedDictionaryNode <K, V>(key, value));
 }