Ejemplo n.º 1
0
        internal void Delete(T value)
        {
            var existing = tree.FindNode(new RangeTreeNode <T>(value));

            if (existing.Value.Values.Count == 1)
            {
                tree.Delete(new RangeTreeNode <T>(value));
                return;
            }

            //remove last
            existing.Value.Values.RemoveAt(existing.Value.Values.Count - 1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete this interval
        /// </summary>
        internal void Delete(OneDimentionalInterval <T> interval)
        {
            sortInterval(interval);

            var existing = redBlackTree.FindNode(interval);

            if (existing != null && existing.Value.End.Count > 1)
            {
                existing.Value.End.RemoveAt(existing.Value.End.Count - 1);
                updateMax(existing);
            }
            else if (existing != null)
            {
                redBlackTree.Delete(interval);
                updateMax(existing.Parent);
            }
            else
            {
                throw new Exception("Interval not found in this interval tree.");
            }

            Count--;
        }
 //O(log(n) time complexity
 public void Remove(TK key)
 {
     binarySearchTree.Delete(new TreeDictionaryNode <TK, TV>(key, default(TV)));
 }
Ejemplo n.º 4
0
 internal void Delete(T value)
 {
     tree.Delete(new RangeTreeNode <T>(value));
 }
Ejemplo n.º 5
0
 //O(log(n) time complexity
 public void Remove(V value)
 {
     binarySearchTree.Delete(value);
 }
 //O(log(n) time complexity
 public void Remove(K key)
 {
     binarySearchTree.Delete(new TreeDictionaryNode <K, V>(key, default(V)));
 }