Misc data structures for php.
A package consisting of a mix of data structures, classes and algorithms I find useful for php 7.1+.
Usage of data structures does not necessarily speed up the end product, but it could very well help in the development process.
The native array type in php can be a pain to keep track of what it is, is it a indexed or associative? Is it supposed to be a queue or a list? Well, by using a data structure as
IndexedList this becomes a bit easier.
The structures all have methods to add and remove objects and works pretty much as one is used to with the type of structure they represent.
The package is a work in progress and new things will be added over time.
If you got a specific request, feel free to add a query through the issue tracker.
Installation and Usage.
Either clone the repository or require the package from composer:
composer require jitesoft/datastructures
Usage is quite self-explanatory, if not, feel free to add a issue for further documentation in the issue tracker.
Currently implemented classes.
The following classes are currently implemented:
- Static classes (
Arrays- Static array methods.
Maps- Static map methods.
- List types (
IndexedList- A indexed list implementation wrapping the native array.
LinkedList- A indexed list implementation as a linked list.
- Sorting (
AbstractSort- Class used to implement user defined sorting methods.
NativeSort- A implementation of the
GnomeSort- A implementation of the
AbstractSortusing the Gnome sort sorting algorithm.
QuickSort- A implementation of the
AbstractSortusing the Quick sort sorting algorithm.
- Queue types (
Jitesoft\Utilities\DataStructures\Queues) (FiFo queue)
LinkedQueue- A queue implementation with a linked list as base.
ArrayQueue- A queue implementation with an array as base.
- Stack types (
Jitesoft\Utilities\DataStructures\Stacks) (LiFo queue)
LinkedStack- A stack implementation with a linked list as base.
ArrayStack- A stack implementation with an array as base.
- Grid types (
Grid- A grid implementation with a IndexedList as container.
- Map types (
SimpleMap- A simple map structure wrapping the native array.