Question: Can someone help me with this in C + + I need help implementing the functions below. The attached photos are the . h files
Can someone help me with this in C
I need help implementing the functions below. The attached photos are the h files that are the declations for the other h files below:
Below is heap.h
#ifndef HEAPH
#define HEAPH
#include
#include
inline constexpr sizet heapleftsizet node
XXX You must implement this.
return ;
inline constexpr sizet heaprightsizet node
XXX You must implement this.
return ;
inline constexpr sizet heapparentsizet node
XXX You must implement this.
return ;
template
void heappreorderArrayLike heapdata, sizet heapnodes, sizet node, FN fn
XXX You must implement this.
template
void heapinorderArrayLike heapdata, sizet heapnodes, sizet node, FN fn
XXX You must implement this.
template
void heappostorderArrayLike heapdata, sizet heapnodes, sizet node, FN fn
XXX You must implement this.
template
void heaplevelorderArrayLike& heapdata, sizet heapnodes, FN fn
XXX You must implement this.
min tree uses less than, so compareparent child should be true
template
bool isheapconst ArrayLike& heapdata, sizet nodes, COMPARISON compare
XXX You must implement this properly.
return false;
template
sizet heapbubbleupRAIterator begin, sizet nodes, sizet start, COMPARE compare
XXX You must implement this properly.
return ;
template
sizet heapbubbledownRAIterator begin, sizet nodes, sizet start, COMPARE compare
XXX You must implement this properly.
return ;
template
void heapinsertCONTAINER& heapdata, sizet& nodes, T key, COMPARISON compare
XXX You must implement this properly.
template
auto heapextractCONTAINER& heapdata, sizet& nodes, COMPARISON compare
XXX You must implement this properly.
return heapdata;
template
sizet heapifyinplaceupRAIterator begin, RAIterator end, COMPARE compare
XXX You must implement this properly.
return ;
template
sizet heapifyinplacedownRAIterator begin, RAIterator end, COMPARE compare
XXX You must implement this properly.
return ;
template
void heapsortRAIterator begin, RAIterator end, COMPARE compare
XXX You must implement this properly.
#endif
Below is heappriorityqueue.h
#ifndef HEAPPQH
#define HEAPPQH
#include "heappriorityqueue.decl.h
template
template
heappriorityqueue::heappriorityqueueITERATOR begin, ITERATOR end
XXX this must be implemented properly.
template
T& heappriorityqueue::top
XXX this must be implemented properly.
static T x; return x; intentionally wrong, but will compile
template
bool heappriorityqueue::empty const
XXX this must be implemented properly.
return true;
template
sizet heappriorityqueue::size const
XXX this must be implemented properly.
return ; intentionally wrong
template
void heappriorityqueue::pushconst T& x
XXX this must be implemented properly.
template
void heappriorityqueue::pop
XXX this must be implemented properly.
This one is provided for you and does not need changes.
template
void heappriorityqueue::dumpdatastd::ostream& ost const
ost ;
for sizet i ; i nodes; i
ost datai;
ost ;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
