A generic heap class

(Available since version 1.0)

Introduction

This is the abstract base class from which all the heap implementations in this library are derived.

It provides the same interface as SplHeap with the extra method, Heap::update() which allows one to update a node in the heap.

With the exceptions of Heap::recoverFromCorruption() and Heap::value(), the methods implemented in this class are common to all of the heap implementations in this library.

Note:

This class is not intended for public consumption. Most users should instead be deriving from one of the 'almost concrete' classes, such as the pairing heap class, SEIDS::Heaps::Pairing::Heap.

Class synopsis

SEIDS::Heaps::Heap implements Countable , Iterator {
/* Properties */
protected int $size ;
/* Methods */
abstract public __construct ([ array $array ] )
abstract protected int compare ( mixed $value1 , mixed $value2 )
abstract public mixed extract ( void )
abstract public bool insert ( mixed $value )
abstract public bool recoverFromCorruption ( void )
abstract public mixed top ( void )
abstract public void update ( mixed $value1 , mixed $value2 )
public int count ( void )
public mixed current ( void )
public bool isEmpty ( void )
public int key ( void )
public void next ( void )
public void rewind ( void )
public bool valid ( void )
protected mixed value ( mixed $value )
protected mixed hashtIndex ( mixed $value )
}

Properties

size

The number of items in the heap.

Table of Contents

To Top