Question
typedef struct MovieReview_struct { } MovieReview; typedef struct ReviewNode_struct { } ReviewNode; ReviewNode *newMovieReviewNode() { /* * This function allocates a new, empty ReviewNode, and
typedef struct MovieReview_struct { } MovieReview;
typedef struct ReviewNode_struct { } ReviewNode;
ReviewNode *newMovieReviewNode() { /* * This function allocates a new, empty ReviewNode, and initializes the * contents of the MovieReview for this node to empty values. * The fields in the MovieReview should be set to: * movie_title="" * movie_studio="" * year = -1 * BO_total = -1 * score = -1 * * The *next pointer for the new node MUST be set to NULL * * The function must return a pointer to the newly allocated and initialized * node. If something goes wrong, the function returns NULL */ /***************************************************************************/ /********** TO DO: Complete this function *********************************/ /***************************************************************************/
return NULL; // <--- This should change when after you implement your solution }
ReviewNode *findMovieReview(char title[MAX_STR_LEN], char studio[MAX_STR_LEN], int year, ReviewNode *head) { /* * This function searches through the linked list for a review that matches the input query. * In this case, the movie review must match the title, studio, and year provided in the * parameters for this function. * * If a review matching the query is found, this function returns a pointer to the node that * contains that review. * * If no such review is found, this function returns NULL */ /***************************************************************************/ /********** TO DO: Complete this function *********************************/ /***************************************************************************/ return NULL; // <--- This should change when after you implement your solution }
ReviewNode *insertMovieReview(char title[MAX_STR_LEN], char studio[MAX_STR_LEN], int year, float BO_total, int score, ReviewNode *head) { /* * This function inserts a new movie review into the linked list. * * The function takes as input parameters the data neede to fill-in the review, * as well as apointer to the current head of the linked list. * * If head==NULL, then the list is still empty. * * The function inserts the new movie review *at the head* of the linked list, * and returns the pointer to the new head node. * * The function MUST check that the movie is not already in the list before * inserting (there should be no duplicate entries). If a movie with matching * title, studio, and year is already in the list, nothing is inserted and the * function returns the current list head. */ /***************************************************************************/ /********** TO DO: Complete this function *********************************/ /***************************************************************************/ return NULL; // <--- This should change when after you implement your solution }
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