Skip to content

Commit

Permalink
Merge branch 'features/splay-tree-extra'
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/DataStructures/SplayTreeTest.php
  • Loading branch information
Ramy-Badr-Ahmed committed Oct 11, 2024
2 parents ea44bed + 0a046c2 commit 1401b14
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/DataStructures/SplayTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,13 @@ public function testDeleteMultipleKeys()
$expectedSize = $treeSize - count($randomNodesToDelete);

foreach ($randomNodesToDelete as $key) {
$splayTree->search($key); // will splay the key to the root before deletion
$splayTree->delete($splayTree->getRoot()->key);
$isFound = $splayTree->isFound($key); // splay the key to the root before deletion
$this->assertTrue($isFound, "Node with key $key is not present for deletion.");

$rootKey = $splayTree->getRoot()->key;
$this->assertEquals($rootKey, $key, "Target key was not splayed to root correctly.");

$isFound = $splayTree->isFound($key);
$this->assertFalse($isFound, "Node with key $key was not deleted.");
$splayTree->delete($splayTree->getRoot()->key);
}

$this->assertEquals(
Expand Down

0 comments on commit 1401b14

Please sign in to comment.