Completed
Push — master ( 6eae43...6111f5 )
by Siro Díaz
02:03
created

AVLNode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 5
1
<?php
2
3
namespace DataStructures\Trees\Nodes;
4
5
use DataStructures\Trees\Nodes\BSTNode;
6
7
/**
8
 * AVLNode is the container class that represent a node inside a AVL tree.
9
 * It is like BST node but has an adicional attribute: height. Height is used
10
 * to know when to balance the AVL tree.
11
 *
12
 * @author Siro Diaz Palazon <[email protected]>
13
 */
14
class AVLNode extends BSTNode {
15
    public $height;
16
17
    public function __construct($key, $data, AVLNode $parent = null, AVLNode $left = null, AVLNode $right = null) {
18
        parent::__construct($key, $data, $parent, $left, $right);
19
        $this->height = 0;
20
    }
21
}