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

AVLTree   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createNode() 0 3 1
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
}