angle / tree
Basic binary tree implementation in PHP.
v1.0.0
2019-03-10 15:01 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^7.5
- symfony/var-dumper: ^4.2
This package is auto-updated.
Last update: 2025-01-11 15:30:11 UTC
README
Simple binary tree implementation in PHP.
Installation
composer require angle/tree
Usage
Creating a tree:
use Angle\Tree\Leaf; $tree = new Leaf(10); $tree->insert(5); $tree->insert(15); $tree->insert(8);
Check for values within the tree:
$tree->contains(5); // true $tree->contains(42); // false
Climb the tree:
$tree->left->right->data == 8; // true
Contributing
Improvements are welcome! Feel free to submit pull requests.
Licence
MIT
Copyright © 2019 Angle Software