chdemko / sorted-collections
Sorted Collections for PHP >= 8.1
Installs: 1 129 452
Dependents: 3
Suggesters: 0
Security: 0
Stars: 22
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=8.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.6
- phpbench/phpbench: ^1.2
- phpunit/phpunit: ^10.2
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2024-03-10 13:33:09 UTC
README
Sorted Collection for PHP. Insertion, search, and removal compute in log(n)
time where n
is the number of items present in the collection. It uses AVL threaded tree [see @Knuth97, 1:320, Sect. 2.3.1] as internal structure.
@Knuth97: Donald E. Knuth, The Art of Computer Programming, Addison-Wesley, volumes 1 and 2, 2nd edition, 1997.
This project uses:
- PHP Code Sniffer for checking PHP code style
- PHPUnit for unit test (100% covered)
- Sphinx and Doxygen for the documentation
Instructions
Using composer: either
$ composer create-project chdemko/sorted-collections:1.0.*@dev; cd sorted-collections
or create a composer.json
file containing
{ "require": { "chdemko/sorted-collections": "1.0.*@dev" } }
and run
$ composer install
Create a test.php
file containg
<?php require __DIR__ . '/vendor/autoload.php'; use chdemko\SortedCollection\TreeMap; $tree = TreeMap::create()->put( [1=>1, 9=>9, 5=>5, 2=>2, 6=>6, 3=>3, 0=>0, 8=>8, 7=>7, 4=>4] ); echo $tree . PHP_EOL;
And run
$ php test.php
This should print
[0,1,2,3,4,5,6,7,8,9]
See the examples and benchmarks folders for more information.
Documentation
Run
$ sudo apt install doxygen python3-pip python3-virtualenv $ virtualenv venv $ venv/bin/activate (venv) $ pip install -r docs/requirements.txt (venv) $ sphinx-build -b html docs/ html/ (venv) $ deactivate $
if you want to create local documentation with Sphinx.
Citation
If you are using this project including publication in research activities, you have to cite it using (BibTeX format). You are also pleased to send me an email to chdemko@gmail.com.
- authors: Christophe Demko
- title: php-sorted-collections: a PHP library for handling sorted collections
- year: 2014
- how published: https://packagist.org/packages/chdemko/sorted-collections
All releases can be found here