Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.
/ php-heap Public archive

[DEPRECATED] Heap - specialized tree-based data structure in pure PHP

License

Notifications You must be signed in to change notification settings

akondas/php-heap

Repository files navigation

[DEPRACTED] Moved to https://github.com/php-ai/php-data-structures

PHP-Heap

Minimum PHP Version Build Status

Heap - specialized tree-based data structure.

This repository contains different heap implementations written in pure PHP.

interface Heap
{
    /**
     * @return mixed
     */
    public function peek();

    /**
     * @param mixed $node
     */
    public function push($node): void;

    /**
     * @return mixed
     */
    public function pop();

    public function size(): int;

    public function isEmpty(): bool;

    public function nodes(): array;
}

BinaryHeap

Find max/min complexity Θ(1), faster than php native sort (check benchmarks).