Esempio n. 1
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on succes; non-zero on failure.
  */
 public static function main($args)
 {
     printf("Demonstration program number 6.\n");
     $status = 0;
     BinaryHeap::main($args);
     LeftistHeap::main($args);
     BinomialQueue::main($args);
     Deap::main($args);
     return $status;
 }
Esempio n. 2
0
    {
        if ($this->isEmpty()) {
            throw new ContainerEmptyException();
        }
        $result = $this->key;
        $left = $this->left;
        $right = $this->right;
        $this->purge();
        $this->swapContentsWith($left);
        $this->merge($right);
        return $result;
    }
    //}>e
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("LeftistHeap main program.\n");
        $status = 0;
        $bst = new LeftistHeap();
        AbstractPriorityQueue::test($bst);
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(LeftistHeap::main(array_slice($argv, 1)));
}