Пример #1
0
<?php

$GLOBALS['client'] = 'Tests';
echo "<p>Starting PriorityQueue test.</p>";
echo "New PriorityQueue, ";
$pq = new PriorityQueue();
echo "done.";
$pq->renderInternalRepresentation();
echo "<br>";
echo "Insert (1, 'one') into pq, ";
$pq->insert(1, 'one');
echo "done.";
$pq->renderInternalRepresentation();
echo "<br>";
echo "Insert (2, 'two') into pq, ";
$pq->insert(2, 'two');
echo "done.";
$pq->renderInternalRepresentation();
echo "<br>";
echo "Insert (0, 'zero') into pq, ";
$pq->insert(0, 'zero');
echo "done.";
$pq->renderInternalRepresentation();
echo "<br>";
echo "Top of pq: ";
var_dump($pq->top());
$pq->renderInternalRepresentation();
echo "<br>";
echo "Pop pq: ";
var_dump($pq->pop());
$pq->renderInternalRepresentation();