https://github.com/anglesoft/tree
🌳 Simple binary tree implementation in PHP.
https://github.com/anglesoft/tree
data-structures-algorithms php
Last synced: 13 days ago
JSON representation
🌳 Simple binary tree implementation in PHP.
- Host: GitHub
- URL: https://github.com/anglesoft/tree
- Owner: anglesoft
- License: mit
- Created: 2019-03-10T13:13:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-10T16:50:30.000Z (almost 7 years ago)
- Last Synced: 2024-04-26T23:02:59.401Z (almost 2 years ago)
- Topics: data-structures-algorithms, php
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌳 Tree
Simple binary tree implementation in PHP.
## Installation
```shell
composer require angle/tree
```
## Usage
Creating a tree:
```php
use Angle\Tree\Leaf;
$tree = new Leaf(10);
$tree->insert(5);
$tree->insert(15);
$tree->insert(8);
```
Check for values within the tree:
```php
$tree->contains(5); // true
$tree->contains(42); // false
```
Climb the tree:
```php
$tree->left->right->data == 8; // true
```
## Contributing
Improvements are welcome! Feel free to submit pull requests.
## Licence
MIT
Copyright © 2019 [Angle Software](https://angle.software)