Question
There's an error in the code that I can't spot that's leaving spaces. Please help! Output below: #include #include #include using namespace std; void inputHeap(vector
There's an error in the code that I can't spot that's leaving spaces. Please help! Output below:
#include
#include
int main() { vector inputCommand(heap); return 0; } void inputHeap(vector void print(vector bool maxHeap(vector while (!maxHeap(heap)) { for (parent = heap.size() / 2; parent > 0; parent--) { is_heap = false; l_child = 2 * parent; r_child = 2 * parent + 1; while (!is_heap && l_child = heap[l_child]) { is_heap = true; } else { swap(heap[parent], heap[l_child]); } } } } } } void insert(vector //function displays maximum value in the heap void displayMax(vector string command; int node_val; int update_val; for (int x = 0; x > command; if (command == "insert") { cin >> node_val; insert(heap, node_val); } else if (command == "delete") { cin >> node_val; deleteNode(heap, node_val); } else if (command == "update") { cin >> node_val >> update_val; update(heap, node_val, update_val); } else if (command == "display") { print(heap); } else if (command == "displayMax") { displayMax(heap); } else if (command == "deleteMax") { deleteMax(heap); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started