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 5.\n");
     $status = 0;
     GeneralTree::main($args);
     BinaryTree::main($args);
     NaryTree::main($args);
     BinarySearchTree::main($args);
     AVLTree::main($args);
     MWayTree::main($args);
     BTree::main($args);
     return $status;
 }
Esempio n. 2
0
        $this->height = 0;
    }
    //}>f
    //{
    /**
     * Detaches the key from this node; making it the empty node.
     */
    public function detachKey()
    {
        $this->height = -1;
        return parent::detachKey();
    }
    //}>g
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("AVLTree main program.\n");
        $status = 0;
        $bst = new AVLTree();
        AbstractSearchTree::test($bst);
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(AVLTree::main(array_slice($argv, 1)));
}