@@ 24-34 (lines=11) @@ | ||
21 | * |
|
22 | * @author Siro Diaz Palazon <[email protected]> |
|
23 | */ |
|
24 | class BinarySearchTree extends BinaryTreeAbstract { |
|
25 | ||
26 | public function __construct() { |
|
27 | $this->root = null; |
|
28 | $this->size = 0; |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * Creates a BSTNode. |
|
33 | * |
|
34 | * @param int|string $key the key used to store. |
|
35 | * @param mixed $data the data. |
|
36 | * @param DataStructures\Trees\Nodes\BSTNode|null $parent the parent node. |
|
37 | * @param DataStructures\Trees\Nodes\BSTNode|null $left the left child node. |
@@ 22-29 (lines=8) @@ | ||
19 | * |
|
20 | * @author Siro Diaz Palazon <[email protected]> |
|
21 | */ |
|
22 | class AVLNode extends BSTNode { |
|
23 | public $height; // the node height |
|
24 | ||
25 | public function __construct($key, $data, $parent = null, $left = null, $right = null) { |
|
26 | parent::__construct($key, $data, $parent, $left, $right); |
|
27 | $this->height = 0; |
|
28 | } |
|
29 | } |