Question: Please help with the following c++ homework on Binary Search Trees. It seems long but it's very straightforward, and most functions could be found online

Please help with the following c++ homework on Binary Search Trees. It seems long but it's very straightforward, and most functions could be found online likely.

 Please help with the following c++ homework on Binary Search Trees.

It seems long but it's very straightforward, and most functions could be

found online likely. Here is the def. of movie tree (movietree.hpp): #pragma

once #include // MovieNode: node struct that will be stored in the

Here is the def. of movie tree (movietree.hpp):

#pragma once #include  // MovieNode: node struct that will be stored in the MovieTree BST struct MovieNode { int ranking; // Rank of the movie std::string title; // Title of the movie int year; // Year this movie was released float rating; // IMDB rating MovieNode *parent = nullptr; // Pointer to the parent node MovieNode *leftChild = nullptr; // Pointer to the leftchild MovieNode *rightChild = nullptr; // Pointer to the rightChild // default constructor MovieNode(){} // Parametrized constructor MovieNode(int r, std::string t, int y, float q) : ranking(r), title(t), year(y), rating(q) {} }; // Class for storing and manipulating a tree of MovieNode's class MovieTree { public: // Check writeup for detailed function descriptions MovieTree(); ~MovieTree(); void printMovieInventory(); void addMovieNode(int ranking, std::string title, int year, float rating); void findMovie(std::string title); void queryMovies(float rating, int year); void averageRating(); private: MovieNode *search(std::string title); // Pointer to the root node MovieNode *root; };

Background In 2009, Netflix held a competition to see who could best predict user ratings for films based on previous ratings without any other information about the users or films. The grand prize of US$1,000,000 was given to the BellKor's Pragmatic Chaos team which bested Netflix's own algorithm for predicting ratings by 10.06%. This kind of data science is facilitated with the application of good data structures. In fact, cleaning and arranging data in a conducive manner is half the battle in making successful predictions. Imagine you are attempting to predict user ratings given a dataset of IMDB's top 100 movies. Building a binary search tree will enable you to search for movies and extract their features very efficiently. The movies will be accessed by their titles, but they will also store the following features IMDB ranking (1-100) Title e Year released IMDB average rating Your binary search tree will utilize the following struct with default and overloaded constructors struct MovieNode int ranking; std::string title; int year; float rating; MovieNode *parent nullptr; MovieNode *leftChild nullptr; MovieNode *rightChild-nullptr; MovieNode) fh MovieNode(int r, std::string t, int y, float q): ranking(r), title(t), year(y), rating(q) t) l; Movie Cl Your code should implement a binary search tree of movies. A header file that lays out this tree can be found in Movie Tree.hpp on Moodle. As usual, do not modify the header file. You may implement helper functions in your.cpp file to facilitate recursion if you want as long as you don't add those functions to the Movie Tree class MovieTree0) Constructor initialize any member variables of the class to default -MovieTree0) Destructor: Free all memory that was allocated MovieNode *search(string title) This private function is meant to be a helper function. Return a pointer to the node with the given title, or nullptr if no such movie exists void printMovielnventory(0 Print every node in the tree in alphabetical order of titles using the following format Ifor every Movie node (m) in the tree cout Add a node to the tree in the correct place based on its title. Every node's left children should come before it alphabetically, and every node's right children should come after it alphabetically. Hint: you can compare strings with ,string::compare() function etc. You may assume that no two movies have the same title void findMovie(string title) Find the movie with the given title, then print out its information cout ranking title year rating title year ,,,,,, Add a node to the tree in the correct place based on its title. Every node's left children should come before it alphabetically, and every node's right children should come after it alphabetically. Hint: you can compare strings with ,string::compare() function etc. You may assume that no two movies have the same title void findMovie(string title) Find the movie with the given title, then print out its information cout ranking title year rating title year ,,,,,,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!