Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doganoo/PHPAlgorithms
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
https://github.com/doganoo/PHPAlgorithms
List: PHPAlgorithms
algorithm algorithms cracking-the-coding-interview datastructures gayle-laakmann-mcdowell lists maps php php7
Last synced: 5 days ago
JSON representation
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
- Host: GitHub
- URL: https://github.com/doganoo/PHPAlgorithms
- Owner: doganoo
- License: mit
- Created: 2018-02-18T17:57:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-24T09:07:15.000Z (about 1 year ago)
- Last Synced: 2024-10-31T18:02:09.737Z (10 days ago)
- Topics: algorithm, algorithms, cracking-the-coding-interview, datastructures, gayle-laakmann-mcdowell, lists, maps, php, php7
- Language: PHP
- Homepage:
- Size: 515 KB
- Stars: 938
- Watchers: 40
- Forks: 92
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PHPAlgorithms
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
You can find the package on Packagist: https://packagist.org/packages/doganoo/php-algorithms
## Why Using PHPAlgorithms?
"Algorithms + Data Structures = Programs"
Algorithms are a part of the basic toolkit for solving problems. Data Structures organize data in an efficient way. The combination of both allow the creation of smart and efficient software.
## Installation
You can install the package via composer:
```bash
composer require doganoo/php-algorithms
```## Usage
Here's an Binary Tree example:
```php
use doganoo\PHPAlgorithms\Datastructure\Graph\Tree\BinaryTree;$binaryTree = new BinaryTree();
$binaryTree->insertValue(50);
$binaryTree->insertValue(25);
$binaryTree->insertValue(75);
$binaryTree->insertValue(10);
$binaryTree->insertValue(100);echo json_encode($binaryTree);
```produces
```php
{"nodes":{"value":50,"left":{"value":25,"left":{"value":10,"left":null,"right":null},"right":null},"right":{"value":75,"left":null,"right":{"value":100,"left":null,"right":null}}}}
```## Contributions
Feel free to send a pull request to add more algorithms and data structures. Please make sure that you read https://github.com/doganoo/PHPAlgorithms/wiki/Best-Practices before opening a PR.
Please also consider https://github.com/doganoo/PHPAlgorithms/blob/master/CONTRIBUTING.md.## Maintainer/Creator
Doğan Uçar ([@doganoo](https://www.dogan-ucar.de))
## License
MIT