[DEPRACTED] Moved to https://github.com/php-ai/php-data-structures
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;
}
Find max/min complexity Θ(1)
, faster than php native sort
(check benchmarks).