Skip to content

Templated implementation of a binary heap in C++ that supports insertion, min deletion, and update.

Notifications You must be signed in to change notification settings

MichaelSheely/binaryHeap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

binaryHeap

A simple general purpose min-queue which is implemented in C++ using a binary heap. The underlying data structure is a simple array so that node traversal may be done via simple pointer arithmetic (standard for heaps, of course). The queue supports insertion, min-lookup, min-deletion, and weight adjusting (helpful for algorithms such as Prim's and Dijkstra's). The data structure is templated such that it may hold any objects as long as they are tagged with an integral priority.

Code Examples

An example use case is shown below:

#include "binaryHeap.h"
#include <math.h>       /* cos gives priority values */

inHeap<int> heap;
for (unsigned i = 0; i < 10; ++i) {
  heap.enqueue(i, cos(i));
}
int currentMin = heap.findMin();
heap.deleteMin();

Installation

Coming soon!

API Reference

Coming soon!

Tests

Coming soon!

Contributors

Lisa Yin (HMC '17)

Michael Sheely (HMC '17)

License

Unlicenced. Feel free to use, modify, and share however you see fit.

About

Templated implementation of a binary heap in C++ that supports insertion, min deletion, and update.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published