mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 14:38:39 +00:00
fix tests
This commit is contained in:
parent
ec49bf2dc1
commit
d22f0a6d18
|
|
@ -9,6 +9,7 @@
|
||||||
* @license OMS License 2.0
|
* @license OMS License 2.0
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @link https://jingga.app
|
* @link https://jingga.app
|
||||||
|
* @link https://github.com/PetarV-/Algorithms/blob/master/Data%20Structures/Binary%20Search%20Tree.cpp
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
@ -229,7 +230,10 @@ class BinarySearchTree
|
||||||
public function delete(Node $node) : void
|
public function delete(Node $node) : void
|
||||||
{
|
{
|
||||||
if ($node->left === null && $node->right === null) {
|
if ($node->left === null && $node->right === null) {
|
||||||
if ($node->parent !== null) {
|
if ($node->parent === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
) {
|
) {
|
||||||
|
|
@ -239,9 +243,6 @@ class BinarySearchTree
|
||||||
) {
|
) {
|
||||||
$node->parent->right = null;
|
$node->parent->right = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//$node = null;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user