I'm trying to create a heap based priority queue for a fractional knapsack problem that has to implemented in C++ for my assignment. I'm using this way to construct the items and I just want to get some ideas. We have created heaps during class just for 'int' but I cannot just wrap my head around this issue about how to create that heap based priority queue on the basis of the value of the items. I'm not looking for someone to give me the codes, just help me out, I honestly need some. Thank you in advance.
struct Item {
int iNo;
float weight;
float benefit;
float value;
};
Aucun commentaire:
Enregistrer un commentaire