Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I haven't worked in c++ in the longest time and I am having trouble on how to do my project. I have to write my

I haven't worked in c++ in the longest time and I am having trouble on how to do my project. I have to write my own data types HEAP and ELEMENT, but I keep running into some errors. I am looking to get help on how to go about what so far I have my code. Not only do I need a solution, but some explanation would be great!

For HEAP - a data type that is a data type that contains three fields named capacity (of type int),size(of type int), and H (an array of type ELEMENT with index ranging from 0 to capacity ).

For ELEMENT - is a data type that contains a field named key, which is of type int. Note that ELEMENT should not be of type int.

This is what I have so far, I wasn't able to finish though to the fact I am really stuck

HEAP

image text in transcribed

image text in transcribed

ELEMENT

image text in transcribed

image text in transcribed

~Thank you in advance

#include #include "HEAP . hpp" HEAP: :HEAP) capacity- size e; H(ELEMENT) malloc(0); void HEAP::setcapazity(int cap) capacity cap void HEAP: : setSize(int s) size s; void HEAP: : setELEMENT (ELEMENT elem) #1fndef #define ELEMENT-hpp ELEMENT-hpp #include class ELEMENT public: //constructor ELEMENT(int num); -ELEMENTOl //Accesors Functions int getKey) const private: int keyi Hi #endif /* ELEMENT-hpp */ #include "ELEMENT . hpp" ELEMENT::ELEMENT (int num)t key = num; int ELEMENT::getKey() constt return key

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions