Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

heap Class Reference

A simple & efficient heap class which uses graph objects. More...

#include <heap.h>

List of all members.

Public Member Functions

 heap (int s=DEFAULT_SIZE)
 ~heap ()
unsigned int size ()
void add (graph_object *val)
 Add object into heap.

void decreaseKey (graph_object *val)
 Indicate that the key for a particular object has decreased.

bool isIn (graph_object *val)
 Returns true if the object is in the heap.

graph_objectremove ()
 Remove the item with the lowest key from the heap & re-heapify.

graph_objectpeek ()
 Return the item with the lowest key; don't remove it from the heap.

bool empty ()
 Returns true if no items are in the heap.


Private Member Functions

void heapifyUp (int index)
void heapifyDown (int index)

Private Attributes

std::vector< graph_object * > _elts
int count


Detailed Description

A simple & efficient heap class which uses graph objects.


Constructor & Destructor Documentation

heap::heap int  s = DEFAULT_SIZE  ) 
 

heap::~heap  ) 
 


Member Function Documentation

void heap::add graph_object val  ) 
 

Add object into heap.

void heap::decreaseKey graph_object val  ) 
 

Indicate that the key for a particular object has decreased.

bool heap::empty  ) 
 

Returns true if no items are in the heap.

void heap::heapifyDown int  index  )  [private]
 

void heap::heapifyUp int  index  )  [private]
 

bool heap::isIn graph_object val  ) 
 

Returns true if the object is in the heap.

graph_object * heap::peek  ) 
 

Return the item with the lowest key; don't remove it from the heap.

graph_object * heap::remove  ) 
 

Remove the item with the lowest key from the heap & re-heapify.

unsigned int heap::size  ) 
 


Member Data Documentation

std::vector<graph_object *> heap::_elts [private]
 

int heap::count [private]
 


The documentation for this class was generated from the following files:
Generated on Tue Aug 18 03:42:54 2009 for HOG by doxygen 1.3.4