Example #1
0
 /**
  * Delete node by key
  * @param KeyInterface $key
  */
 public function delete(KeyInterface $key)
 {
     if (!$this->root->getLeft()->isRed() && !$this->root->getRight()->isRed()) {
         $this->root->setColor(Node::RED);
     }
     $this->_delete($this->root, $key);
     if (!$this->root->isEmpty()) {
         $this->root->setColor(Node::BLACK);
     }
 }