C++ Prim's Algorithm

shoedatUL

Beta member
Messages
1
I got to my minHeap to work and here is my minHeap.h file, i just need to implement a Minimal Spanning Tree using Prim's Algorithm that uses my minHeap files. My minHeap works fine, its just hard to know where to start with the Prim's Algorithm and how to use my current classes with the new MST Prim classes. If anyone can help then horray for you, and here's a cookie! ;) YAY!!!


//minHeap.h

template<class Heap>
class BinaryHeap;

template<class Heap>
class BinaryHeap
{
public:
//public functions that the user are allowed to call from the driver
explicit BinaryHeap(int capacity);
void insert(Heap x);
void removeMin();
void trans();
private:
//private functions that the user cannot call from the driver
int isLeaf(int num);
int rightChild(int x);
int leftChild(int x);
int parent(int x);
void order();
//variables needed to implement and create a minHeap
Heap *array;
int max;
int current;
};
 
Back
Top Bottom