PHP Class Heap, AlgorithmsNYC

Show file Open project: AlgorithmsNYC/AlgorithmsNYC Class Usage Examples

Public Properties

Property Type Description
$keys - the children's values must be equal or greater to the parent's value

Public Methods

Method Description
extract_min ( ) Function to extract the minimum value of the heap
insert ( $value ) Basic function to add a value to the heap
node_child_left ( $key ) Gets the left child's key of a given node
node_child_right ( $key ) Gets the right child's key of a given node
node_parent ( $key ) Gets the parent's key of a given node
smallest_child_key ( $index ) Gets the child key of the lowest value of the children of a given node
smallest_child_value ( $index ) Gets the lowest value of the children of a given node
toString ( )

Method Details

extract_min() public method

Function to extract the minimum value of the heap
public extract_min ( )

insert() public method

Basic function to add a value to the heap
public insert ( $value )

node_child_left() static public method

Gets the left child's key of a given node
static public node_child_left ( $key )

node_child_right() static public method

Gets the right child's key of a given node
static public node_child_right ( $key )

node_parent() static public method

Gets the parent's key of a given node
static public node_parent ( $key )

smallest_child_key() public method

Gets the child key of the lowest value of the children of a given node
public smallest_child_key ( $index )

smallest_child_value() public method

Gets the lowest value of the children of a given node
public smallest_child_value ( $index )

toString() public method

public toString ( )

Property Details

$keys public property

- the children's values must be equal or greater to the parent's value
public $keys