localheinz / data-structure
This package is abandoned and no longer maintained.
No replacement package was suggested.
Provides implementations of data structures.
dev-master
2019-12-07 08:15 UTC
Requires
- php: ^7.2
Requires (Dev)
- ergebnis/php-cs-fixer-config: ~1.1.0
- infection/infection: ~0.13.6
- localheinz/composer-normalize: ^1.3.1
- localheinz/phpstan-rules: ~0.13.0
- localheinz/test-util: ~0.8.0
- phpstan/phpstan: ~0.11.19
- phpstan/phpstan-deprecation-rules: ~0.11.2
- phpstan/phpstan-strict-rules: ~0.11.1
- phpunit/phpunit: ^8.5.0
This package is auto-updated.
Last update: 2019-12-07 08:16:41 UTC
README
This package provides implementations of data structures.
Installation
Run
$ composer require localheinz/data-structure
Data Structures
Localheinz\DataStructure\Queue
Localheinz\DataStructure\Stack
Queue
use Localheinz\DataStructure\Queue; $queue = new Queue(); $queue->isEmpty(); // true $queue->isFull(); // false $queue->enqueue('foo'); $queue->enqueue('bar'); $queue->isEmpty(); // false $queue->isFull(); // false $queue->dequeue(); // 'foo' $queue->dequeue(); // 'bar' $queue->isEmpty(); // true $queue->isFull(); // false $maxSize = 1; $anotherQueue = new Queue($maxSize); $anotherQueue->enqueue('foo'); $anotherQueue->isFull(); // true
Stack
use Localheinz\DataStructure\Stack; $stack = new Stack(); $stack->isEmpty(); // true $stack->isFull(); // false $stack->push('foo'); $stack->push('bar'); $stack->isEmpty(); // false $stack->isFull(); // false $stack->peek(); // 'bar' $stack->pop(); // 'bar' $stack->pop(); // 'foo' $stack->isEmpty(); // true $stack->isFull(); // false $maxSize = 1; $anotherStack = new Stack($maxSize); $anotherStack->push('foo'); $anotherStack->isFull(); // true
Changelog
Please have a look at CHANGELOG.md
.
Contributing
Please have a look at CONTRIBUTING.md
.
Code of Conduct
Please have a look at CODE_OF_CONDUCT.md
.
License
This package is licensed using the MIT License.