mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +00:00
null fixes
This commit is contained in:
parent
bd29e83c06
commit
2b6e7b008d
|
|
@ -249,15 +249,15 @@ class BinarySearchTree
|
||||||
if ($node->parent->left !== null
|
if ($node->parent->left !== null
|
||||||
&& $node->parent->left->root?->compare($node->data) === 0
|
&& $node->parent->left->root?->compare($node->data) === 0
|
||||||
) {
|
) {
|
||||||
$node->parent->left = $temp->tree;
|
$node->parent->left = $temp?->tree;
|
||||||
} elseif ($node->parent->right !== null
|
} elseif ($node->parent->right !== null
|
||||||
&& $node->parent->right->root?->compare($node->data) === 0
|
&& $node->parent->right->root?->compare($node->data) === 0
|
||||||
) {
|
) {
|
||||||
$node->parent->right = $temp->tree;
|
$node->parent->right = $temp?->tree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp->parent = $node->parent;
|
$temp->parent = $node?->parent;
|
||||||
|
|
||||||
$node = null;
|
$node = null;
|
||||||
|
|
||||||
|
|
@ -270,21 +270,20 @@ class BinarySearchTree
|
||||||
if ($node->parent->left !== null
|
if ($node->parent->left !== null
|
||||||
&& $node->parent->left->root?->compare($node->data) === 0
|
&& $node->parent->left->root?->compare($node->data) === 0
|
||||||
) {
|
) {
|
||||||
$node->parent->left = $temp->tree;
|
$node->parent->left = $temp?->tree;
|
||||||
} elseif ($node->parent->right !== null
|
} elseif ($node->parent->right !== null
|
||||||
&& $node->parent->right->root?->compare($node->data) === 0
|
&& $node->parent->right->root?->compare($node->data) === 0
|
||||||
) {
|
) {
|
||||||
$node->parent->right = $temp->tree;
|
$node->parent->right = $temp?->tree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp->parent = $node->parent;
|
$temp->parent = $node?->parent;
|
||||||
|
|
||||||
$node = null;
|
$node = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} elseif (($temp = $this->successor($node)) !== null) {
|
||||||
$temp = $this->successor($node);
|
|
||||||
$node->key = $temp->key;
|
$node->key = $temp->key;
|
||||||
$node->data = $temp->data;
|
$node->data = $temp->data;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user