Skip to content

Commit

Permalink
Implemented Splay Tree Data Structure. Added abstract setRoot() decla…
Browse files Browse the repository at this point in the history
…ration to the SplayTreeRotations.php
  • Loading branch information
Ramy-Badr-Ahmed committed Oct 11, 2024
1 parent eed2b3c commit e2d9d80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DataStructures/SplayTree/SplayTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getRoot(): ?SplayTreeNode
* Set the root node of the Splay Tree.
* @param SplayTreeNode $node
*/
public function setRoot(SplayTreeNode $node): void
protected function setRoot(SplayTreeNode $node): void
{
$this->root = $node;
}
Expand Down
1 change: 1 addition & 0 deletions DataStructures/SplayTree/SplayTreeRotations.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
abstract class SplayTreeRotations
{
abstract protected function splay(?SplayTreeNode $node, int $key): ?SplayTreeNode;
abstract protected function setRoot(SplayTreeNode $node): void;

/**
* Zig rotation (single right rotation).
Expand Down

0 comments on commit e2d9d80

Please sign in to comment.