Completed
Push — master ( f1605c...0f0c8b )
by Siro Díaz
02:06
created

AVLTree::createNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 5
1
<?php
2
/**
3
 * DataStructures for PHP
4
 *
5
 * @link      https://github.com/SiroDiaz/DataStructures
6
 * @copyright Copyright (c) 2017 Siro Díaz Palazón
7
 * @license   https://github.com/SiroDiaz/DataStructures/blob/master/README.md (MIT License)
8
 */
9
namespace DataStructures\Trees;
10
11
use DataStructures\Trees\BinaryTreeAbstract;
12
use DataStructures\Trees\Nodes\AVLNode;
13
14
/**
15
 * AVLTree
16
 *
17
 * This class is an implementation of a AVL tree. It has as main feature that access,
18
 * insertion and deletion is O(log n). This is like a BST but it has a slightly difference
19
 * in nodes: contains a height attribute, used to detect when is needed to rebalance the
20
 * tree to keep the O(log n).
21
 *
22
 * @author Siro Diaz Palazon <[email protected]>
23
 */
24
class AVLTree extends BinaryTreeAbstract {
25
    
26
    public function createNode($key, $data, $parent = null, $left = null, $right = null) {
27
        return new AVLNode($key, $data, $parent, $left, $right);
28
    }
29
}