public Tuple <int, int> EqualRange(T v) { if (!Contains(v)) { return(new Tuple <int, int>(-1, -1)); } return(new Tuple <int, int>(SB_BinarySearchTree <T> .LowerBound(_root, v), SB_BinarySearchTree <T> .UpperBound(_root, v) - 1)); }
public T ElementAt(int k) { var node = SB_BinarySearchTree <T> .FindByIndex(_root, k); if (node == null) { throw new IndexOutOfRangeException(); } return(node.Value); }
public override void Insert(T v) { if (_root == null) { _root = new SB_BinarySearchTree <T> .Node(v); } else { _root = SB_BinarySearchTree <T> .Insert(_root, v); } }
public virtual void Insert(T v) { if (_root == null) { _root = new SB_BinarySearchTree <T> .Node(v); } else { if (SB_BinarySearchTree <T> .Find(_root, v) != null) { return; } _root = SB_BinarySearchTree <T> .Insert(_root, v); } }
public List <T> ToList() { return(new List <T>(SB_BinarySearchTree <T> .Enumerate(_root))); }
public int UpperBound(T v) { return(SB_BinarySearchTree <T> .UpperBound(_root, v)); }
public int Count(T v) { return(SB_BinarySearchTree <T> .UpperBound(_root, v) - SB_BinarySearchTree <T> .LowerBound(_root, v)); }
public bool Contains(T v) { return(SB_BinarySearchTree <T> .Contains(_root, v)); }
public void Remove(T v) { _root = SB_BinarySearchTree <T> .Remove(_root, v); }
public void Clear() { _root = null; }
public int Count() { return(SB_BinarySearchTree <T> .Count(_root)); }