mrxacx / data-structures
data abstract structures
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpunit/phpunit: ^11.4
README
Essential data structures for computer science, now in PHP.
๐ Summary
๐งพ Lists
LinearList ๐
Values are stored in an array of unique items. Fetch, add, and remove operations have O(n) time complexity.
SortedList ๐
Values are stored in a sorted array of unique items. While add and remove operations have O(n) time complexity, the search operation has O(n log n) time complexity.
LinkedList ๐
Each value is stored once using object references. Fetch, add, and remove operations have O(n) time complexity.
๐๏ธ Stacks
Stack ๐
Last-in-first-out (LIFO) data structure. Items are stored in an array.
LinkedStack ๐
Last-in-first-out (LIFO) data structure. Items are stored using object references.
๐ถ๏ธ๏ธ Queues
Queue ๐
First-in-first-out (FIFO) data structure. Items are stored in an array.
LinkedQueue ๐
First-in-first-out (FIFO) data structure. Items are stored using object references.