My project requires us to build a binary heap. Right now I am testing the insert function with a minimal main. The project won't build and is giving an unresolved linker error. I have no idea what is going on can someone tell what is wrong?
//templated
#include <vector>
#include <iostream>
usingnamespace std;
template<typename K>
class binaryHeap{
public:
int size;
vector<K>heapVect;
void insert(K newData);//not sure on parameters and type
K deleteMin();
int vectSize();
private:
};
template<typename K>
void insert(K newData)//not sure on parameters and type
{
//heapVect.resize(heapVect.size()+1);
size=heapVect.vectSize();
//place the new item at the end of the heap
heapVect[size]= newData;
// percollate
int place = size;
int parent = (place-1)/2;
while ( (parent >= 0) &&
heapVect[place]>heapVect[parent])
{
//swap items
K temp=heapVect[parent];
heapVect[parent]=heapVect[place];
heapVect[place]=temp;
}
++size;
}
template<typename K>
K deleteMin()
{
//K temp=heapVect.pop();
}
template<typename K>
int size()
{
return heapVect.size()+1;
}