adrianoferreira / data-structures
一组用PHP实现的数据结构。
dev-master
2020-01-24 18:20 UTC
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-09-25 05:53:32 UTC
README
一组用PHP实现的数据结构
- 哈希表
- 更多即将到来...
安装
建议使用Composer安装此库。
$ composer require adrianoferreira/data-structures:dev-master
用法
$hashTable = new \AdrianoFerreira\DS\HashTable\Table( 10 ); $hashTable->insert( 'my-key', 'my value' ); $hashTable->insert( 'my-key', 'updated value' ); $hashTable->insert( 'other-key', 'other value' ); $hashTable->insert( 'abc', 'abc value' ); $hashTable->insert( 'cba', 'cba value' ); //Outputs 'updated value' as it replaces the value of buckets with same key echo $hashTable->get('my-key'); //Outputs 'other value' echo $hashTable->get('other-key'); //Outputs 'cba value' echo $hashTable->get('cba');