diff --git a/php/10_heap/main.php b/php/10_heap/main.php new file mode 100644 index 0000000..72e3218 --- /dev/null +++ b/php/10_heap/main.php @@ -0,0 +1,30 @@ +insert($v); +} + +while(($r=$heap->deleteFirst())!==null){ + echo $r." "; +} +echo PHP_EOL; + +$heap1=new Heap(10); + +foreach ($arr as $v){ + $heap1->insertOnly($v); +} + + + +$heap1->heapAll(); +//堆化后的 +print_r($heap1->dataArr); +//堆排序 +$heap1->heapSort(); +print_r($heap1->dataArr);