PHP code example of mathieuviossat / fibonacci-heap

1. Go to this page and download the library: Download mathieuviossat/fibonacci-heap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mathieuviossat / fibonacci-heap example snippets


use MathieuViossat\Util\FibonacciHeap;

$movies = new FibonacciHeap();

$movies->insert(4, 'The Phantom Menace');
$movies->insert(5, 'Attack of the Clones');
$movies->insert(6, 'Revenge of the Sith');
$movies->insert(1, 'A New Hope');
$movies->insert(2, 'The Empire Strikes Back');
$movies->insert(3, 'Return of the Jedi');
$movies->insert(7, 'The Force Awakens');

while ($movie = $movies->extractMin())
    echo $movie->getKey() . ' - ' . $movie->getData() . PHP_EOL;