Follow all code styling and submission instructions as outlined for previous labs.  Derive a MinHeap class from the BST class of your Lab 4 code. Define/Override only the Search/Insert/Delete methods in the new class. Write a new main for this lab which: Will only be a test program for the MinHeap.  Declares and creates a MinHeap object as necessary. Declares and creates the Dollar objects as necessary. Inserts the 20 Dollar objects specified in Lab 4 in the same order. Performs all 4 traversals after the inserting the 10th and the last objects - in total there will be 8 outputs which should be clearly demarcated. No user input is necessary, no data validation is necessary. For submission - upload all class files from Lab 4 as necessary as well as your new MinHeap class and the main. Remember to also include adequate number of screenshots of the program execution. The Discussion forum will be monitored and responded to all week during the Finals. Office Hours will only be held on MTW. For clarifications, post your questions on the Discussion forum first.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Follow all code styling and submission instructions as outlined for previous labs. 

  • Derive a MinHeap class from the BST class of your Lab 4 code.
  • Define/Override only the Search/Insert/Delete methods in the new class.
  • Write a new main for this lab which:
    • Will only be a test program for the MinHeap. 
    • Declares and creates a MinHeap object as necessary.
    • Declares and creates the Dollar objects as necessary.
    • Inserts the 20 Dollar objects specified in Lab 4 in the same order.
    • Performs all 4 traversals after the inserting the 10th and the last objects - in total there will be 8 outputs which should be clearly demarcated.
    • No user input is necessary, no data validation is necessary.
  • For submission - upload all class files from Lab 4 as necessary as well as your new MinHeap class and the main. Remember to also include adequate number of screenshots of the program execution.
  • The Discussion forum will be monitored and responded to all week during the Finals. Office Hours will only be held on MTW. For clarifications, post your questions on the Discussion forum first.
昭」く〉
h BST copy
(+
h BST copy) No Selection
1 #pragma once
/*
3
Lab 4
6.
7 Group: Lab 3 Team 16
8.
9 Assignment Purpose: To demonstrate that we are able to implement a binary search tree abstract data type.
10
11
*/
12
13
#ifndef BST_H
14
#define BST_H
15
16
#include "dollar.h"
17
#include "BSTNode.h"
18
#include <iostream>
19
#include <fstream>
20
21 using namespace std;
22
23
class BST
24
{
25 public:
26
//Default constructor
27
BST()
28
{
29
root =
nullptr;
30
}
31
32
//Default destructor
33
~BST ()
34
35
empty(root);
36
cout << "BST destructor complete" << endl;
37
}
// Empty operation
void empty (BSTNode* curNode)
38
I I
39
I
40
{
41
if (curNode
nullptr)
==
I I
42
{
43
return;
44
}
45
empty(curNode->left);
empty(curNode->right);
delete curNode;
46
47
48
49
}
50
I
//Is-Empty method
bool isEmpty);
I
51
52
53
//Search method
54
BSTNode* search(Dollar key);
55
//Insert method
56
void insert(Dollar userNode);
57
//Delete method
58
void remove(Dollar key);
59
//Print method
Dollar printNode(BSTNode* targetNode, ofstream targetFile);
//Count method
60
61
Line: 1 Col: 1
Transcribed Image Text:昭」く〉 h BST copy (+ h BST copy) No Selection 1 #pragma once /* 3 Lab 4 6. 7 Group: Lab 3 Team 16 8. 9 Assignment Purpose: To demonstrate that we are able to implement a binary search tree abstract data type. 10 11 */ 12 13 #ifndef BST_H 14 #define BST_H 15 16 #include "dollar.h" 17 #include "BSTNode.h" 18 #include <iostream> 19 #include <fstream> 20 21 using namespace std; 22 23 class BST 24 { 25 public: 26 //Default constructor 27 BST() 28 { 29 root = nullptr; 30 } 31 32 //Default destructor 33 ~BST () 34 35 empty(root); 36 cout << "BST destructor complete" << endl; 37 } // Empty operation void empty (BSTNode* curNode) 38 I I 39 I 40 { 41 if (curNode nullptr) == I I 42 { 43 return; 44 } 45 empty(curNode->left); empty(curNode->right); delete curNode; 46 47 48 49 } 50 I //Is-Empty method bool isEmpty); I 51 52 53 //Search method 54 BSTNode* search(Dollar key); 55 //Insert method 56 void insert(Dollar userNode); 57 //Delete method 58 void remove(Dollar key); 59 //Print method Dollar printNode(BSTNode* targetNode, ofstream targetFile); //Count method 60 61 Line: 1 Col: 1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY