Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I just want to know how to write these functions: void deleteMovieNode(std::string title); MovieNode* search(std::string title); MovieNode* treeMinimum(MovieNode *node); I got these three functions, MovieNode*

I just want to know how to write these functions:

void deleteMovieNode(std::string title); 
MovieNode* search(std::string title); 
MovieNode* treeMinimum(MovieNode *node); 

I got these three functions,

MovieNode* search(std::string title); 
MovieNode* treeMinimum(MovieNode *node); they are the helper function I think, and I tried to write these two like this: 
MovieNode* search(std::string title) 

{

MovieNode *foundMovie = root;

while(founMovie != NULL)

{

if(foundMovie->title > title)

{

foundMovie = foundMovie->leftChild;

}else if(foundMovie->title < title)

{

foundMovie = foundMovie->rightChild;

}

return foundMovie;

}

cout<<" Movie not found."<

return NULL;

}

MovieNode* treeMinimum(MovieNode *node) 

{

MovieNode *current = node;

while(current ->lefchild != NULL)

{

current = current->leftChild;

}

return current;

}

But I don't how to use these two to write deleteNode function(ps:if I writed wrong for those two functions,plz help me modify)

one thing I know is that, if i want to use search function;

I can do this:

MovieNode *foundMoive = search(title);

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions