subject

Use the definition and the code for the heap developed in class and add the member function int heapRemove ()to the Heap class. The heapRemove() returns the value of the root and readjust the heap to maintain the heap property. [Hint: heapRemove() uses percolate down function] #include
#include
using namespace std;
// The Node class for the Binary Search Tree
template
class Node
{
public:
Node();
Node(T e, Node* r, Node* l);
T element; // holds the node element
Node* right;
Node* left;
};
// implementation of the constrcutors of the Node
template
Node::Node() { right = left = NULL; }
template
Node::Node(T e, Node* r, Node* l) { element = e; right = r; left = l; }
// Binart Searct Tree (BST) class
template
class BTree
{
public:
BTree() { root = NULL; }
BTree(Node* rt) { root = rt; }
void BSTInsert(T value);
void BSTRemove(T value);
Node*& getRoot() { return root; } // returns the pointer to the root
Node* BSTsearch(T value);
private:
Node* root; // a pointer to the root of the tree
};

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Which best describes the condition under which the unicode output is the same as plain text?
Answers: 3
question
Computers and Technology, 22.06.2019 10:20
Shown below is the start of a coding region within the fist exon of a gene. 5'--3' 3'--5' how many cas9 pam sequences are present?
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
You know the right answer?
Use the definition and the code for the heap developed in class and add the member function int heap...
Questions
question
Mathematics, 23.09.2021 14:30
question
Mathematics, 23.09.2021 14:30
Questions on the website: 13722360