for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DataStructures\Trees\Nodes;
use DataStructures\Trees\Nodes\BSTNode;
/**
* AVLNode is the container class that represent a node inside a AVL tree.
* It is like BST node but has an adicional attribute: height. Height is used
* to know when to balance the AVL tree.
*
* @author Siro Diaz Palazon <[email protected]>
*/
class AVLNode extends BSTNode {
public $height;
public function __construct($key, $data, AVLNode $parent = null, AVLNode $left = null, AVLNode $right = null) {
parent::__construct($key, $data, $parent, $left, $right);
$this->height = 0;
}