Ejemplo n.º 1
0
 protected internal override RedBlackNode BalanceRight(RedBlackNode parent)
 {
     if (this._right is RedNode)
     {
         return(SortedMap.MakeRed(this._key, Value,
                                  SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this._left),
                                  this._right.Blacken()));
     }
     else if (this._left is RedNode)
     {
         return(SortedMap.MakeRed(this._left.Key, this._left.Value,
                                  SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this._left.Left),
                                  SortedMap.MakeBlack(this._key, Value, this._left.Right, this._right)));
     }
     else
     {
         return(base.BalanceRight(parent));
     }
 }
Ejemplo n.º 2
0
 protected internal override RedBlackNode Replace(object key, object val, RedBlackNode left, RedBlackNode right) => SortedMap.MakeBlack(key, val, left, right);
Ejemplo n.º 3
0
 protected internal virtual RedBlackNode BalanceRight(RedBlackNode parent) => SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this);