Starting from:
$30

$24

Lab #6 A Movie Repository II: Movies, Playlists, and Search Trees Solution

In this assignment, you are going to complete your movie library, using Lab 4 as a starting point.




You need to provide a report that shows (20pts):




Your class designs



The algorithms used



This should be in pseudo-code or flowcharts, not just the code you ended up writing



Compiling instructions
Sample runs (screenshots are fine)






Things to have (80pts):




Part 1: Binary Search Tree for the Movies (25pts)




A Binary Search Tree that stores all your Movies for the entire library, this is the MovieTree and is the main repository for your movie library



Basically you are replacing the order linked list from Lab 4 with a Binary Search Tree



The Movies remain the same with their internal Review Lists from Lab 4.



Only the MovieList is scrapped in favor of the BST



Movies are sorted by movie title.



No duplicates are allowed.



Remember that the Movies are referenced through pointers in the tree nodes.



Private pointer to the root of the tree and a count of the number of movies in the tree



A constructor and destructor for the BST
The following public methods:



void addMovie(Movie *s);
Movie *findMovie(string title);



int getDepth();



int getNumMovies();
void printTree(bool ascending=true);
A function to read the movies from a file and load them into the MovieTree








































































Figure 1 BST of Movies

Part 2: RunTime PlayLists of Movies (25pts)




A PlayList for Movies, MoviePlayList



This is a simple linked-list similar to the one you used for the Reviews in Lab 4 except that the Movies in the playlist nodes are pointers to the Movies



You should make the Review and MoviePlay Lists now as a Templates.



Note that the same Movie can exist in different Playlists



Enforce that the same Movie cannot exist in the same Playlist



Not all Movies have to be in a Playlist
Each MoviePlayList also has a title



An algorithm that automatically populates a MoviePlayList with movies based on the Maximum Runtime of the Playlist



The user specifies the total runtime of the PlayList



The system determines the most Movies that can fit into the PlayList from all the available movies.



Part 3: Binary Search Tree for the MoviePlaylists (20pts)




A Binary Search Tree that stores all the Playlists in your repository, this is the
PlaylistTree




The nodes of this tree use pointers to the Playlists to reference them



The tree is sorted by Playlist title



No duplicates are allowed



A function to read the playlists from a file, playlists.txt, create the Playlists and create the PlaylistTree (10pts)


























































































Figure 2 Binary Search Tree of Playlists




Part 4: Menu (10pts)




A menu to allow the user to interact with the system. It should allow (30pts):



Main

Load Movies from file



Load Playlists from file



Songs

List all Movies



Search for Movie by title



Playlists

List all Playlists



Search for Playlist by title
List Movies for Playlist



Create Playlist



Save Playlists
Exit


















Extra Credit: (do option 1 OR option 2, no extra will be given for both)




Option1: Implement Polymorphic Trees (10pts)




Instead of creating two different tree class (one with Movie pointers and one with Playlist pointers), create an abstract superclass with Movie and Playlist as subclasses. Create one tree class that uses pointers to this superclass. Implement a polymorphic compare method for the use by the Tree.




Option2: Implement Genres (10pts)




These are similar to Playlists, but hold related Movies based on Genre. You also need to add another Binary Search Tree for Genre, GenreTree.




Update the menu to allow for Listing/Searching Genre, and the RunTime Playlists to allow specification of Genre in addition to total runtime.

More products