Please help my C++ assignment. Anyone help me please. #include #include #include #include
Posted: Sat Nov 27, 2021 2:20 pm
Please help my C++ assignment. Anyone help me please.
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
template <typename Type>
class priorityQ
{
public:
void
insert(const Type &);
void
deleteHighestPriority ();
private:
int
capacity; //the length of heapArray
int items;
// the amount of item store to the heap
Type *
heapArray; // array contains the element for queue
};
• void priorityQ::insert(const Type& element) - inserts
element to the end of the heap and bubbles the element up, resizes
if needed, also increments items counter by 1
template <typename Type>
void priorityQ<Type>::insert(const Type& element)
{
//Please help this one
}
• void priorityQ::deleteHighestPriority() - removes the root
element by assigning the root with the end element in the heap and
bubbles the element down, also decrements items by 1 (does nothing
if the heap is empty)
template <typename Type>
void priorityQ<Type>::deleteHighestPriority()
{
// Please help this one too.
}
Thank you in advanced! Please ......................... I must
give you thumb up if you did a correct solution.
Posted: Sat Nov 27, 2021 2:20 pm
Please help my C++ assignment. Anyone help me please.
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
template <typename Type>
class priorityQ
{
public:
void
insert(const Type &);
void
deleteHighestPriority ();
private:
int
capacity; //the length of heapArray
int items;
// the amount of item store to the heap
Type *
heapArray; // array contains the element for queue
};
• void priorityQ::insert(const Type& element) - inserts
element to the end of the heap and bubbles the element up, resizes
if needed, also increments items counter by 1
template <typename Type>
void priorityQ<Type>::insert(const Type& element)
{
//Please help this one
}
• void priorityQ::deleteHighestPriority() - removes the root
element by assigning the root with the end element in the heap and
bubbles the element down, also decrements items by 1 (does nothing
if the heap is empty)
template <typename Type>
void priorityQ<Type>::deleteHighestPriority()
{
// Please help this one too.
}
Thank you in advanced! Please ......................... I must
give you thumb up if you did a correct solution.
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
template <typename Type>
class priorityQ
{
public:
void
insert(const Type &);
void
deleteHighestPriority ();
private:
int
capacity; //the length of heapArray
int items;
// the amount of item store to the heap
Type *
heapArray; // array contains the element for queue
};
• void priorityQ::insert(const Type& element) - inserts
element to the end of the heap and bubbles the element up, resizes
if needed, also increments items counter by 1
template <typename Type>
void priorityQ<Type>::insert(const Type& element)
{
//Please help this one
}
• void priorityQ::deleteHighestPriority() - removes the root
element by assigning the root with the end element in the heap and
bubbles the element down, also decrements items by 1 (does nothing
if the heap is empty)
template <typename Type>
void priorityQ<Type>::deleteHighestPriority()
{
// Please help this one too.
}
Thank you in advanced! Please ......................... I must
give you thumb up if you did a correct solution.