for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* DataStructures for PHP
*
* @link https://github.com/SiroDiaz/DataStructures
* @copyright Copyright (c) 2017 Siro Díaz Palazón
* @license https://github.com/SiroDiaz/DataStructures/blob/master/README.md (MIT License)
*/
namespace DataStructures\Trees\Nodes;
use DataStructures\Trees\Interfaces\BinaryNodeInterface;
* BSTNode
* BSTNode Contains all attributes that represent the node for BST
* @author Siro Diaz Palazon <[email protected]>
class BSTNode implements BinaryNodeInterface {
public $key; // key used to insert, remove and retrieve
public $data; // associated data
public $parent; // the parent node
public $left; // left subtree
public $right; // right subtree
public function __construct($key, $data, $parent = null, $left = null, $right = null) {
$this->key = $key;
$this->data = $data;
$this->parent = $parent;
$this->left = $left;
$this->right = $right;
}