public final function getDepth(AbstractBinaryTree $root = NULL) { if ($root == NULL) { return -1; } if ($root instanceof TernaryTree) { return 1 + Math::max($this->getDepth($root->left), $this->getDepth($root->middle), $this->getDepth($root->right)); } else { return 1 + Math::max($this->getDepth($root->left), $this->getDepth($root->right)); } }
public function getDepth(AbstractBinaryTree $root = NULL) { if ($root == NULL) { return -1; } return Math::max($this->getDepth($root->left), $this->getDepth($root->right)) + 1; }
public function subString($start, $end = NULL) { return new StringW(mb_substr($this->string, Math::max(0, $start), Math::max(0, Math::min(Math::max(0, $end), $this->getLength() - 1)), self::UTF8)); }