PHP Класс Heap, AlgorithmsNYC

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$keys - the children's values must be equal or greater to the parent's value

Открытые методы

Метод Описание
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 ( )

Описание методов

extract_min() публичный Метод

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

insert() публичный Метод

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

node_child_left() статический публичный Метод

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

node_child_right() статический публичный Метод

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

node_parent() статический публичный Метод

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

smallest_child_key() публичный Метод

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

smallest_child_value() публичный Метод

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

toString() публичный Метод

public toString ( )

Описание свойств

$keys публичное свойство

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