Hi, I'm a college undergrad and this is my second course in c++. I'm having problems with some code that I'm working on. It might be something really easy to solve, I just can't figure it out. Help, pretty please?!
The program that I'm working on for class has to do with heaps. The directions for the deleteMax function state: "To remove the maximum element in the heap we return the root node and merge both of its children."
What I can't figure out is how to return the root. As you can see, I tried to create a temp pointer, but it won't let me return that because it's not an int.
int ModifiedHeap::deleteMax()
{
if (isEmpty() == true)
return INT_MIN;
ModifiedHeapNode *tmproot = root;
joinR(root->left, root->right);
return tmproot;
}
The program that I'm working on for class has to do with heaps. The directions for the deleteMax function state: "To remove the maximum element in the heap we return the root node and merge both of its children."
What I can't figure out is how to return the root. As you can see, I tried to create a temp pointer, but it won't let me return that because it's not an int.
int ModifiedHeap::deleteMax()
{
if (isEmpty() == true)
return INT_MIN;
ModifiedHeapNode *tmproot = root;
joinR(root->left, root->right);
return tmproot;
}
