Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this problem set is to gain familiarity with heaps and priority queues. The Internet Movie Database (http://www.imdb.com) is an online database of

The purpose of this problem set is to gain familiarity with heaps and priority queues. The Internet Movie Database (http://www.imdb.com) is an online database of information related to movies, tv programs, and videos.  You can download plain text data files; directions are at http://www.imdb.com/interfaces.  Please read the statement about restrictions on use of the data. In  this  exercise  we  will  work  with  movie  ratings.    I  have  used  the  files  title.basics.tsv  and  title.ratings.tsv  to  produce  the  file  ratings.tsv,  which  contains one line of tab-separated values for each movie that has been rated.  The first five lines (of 254, 566) of the file are:


56      5.9     Miss Jerry

41      6.1     Soldiers of the Cross

6       3.8     Bohemios

594     6.1     The Story of the Kelly Gang

15      4.5     Robbery Under Arms


The first value on each line is the number of ratings that the movie received, and the second value is the average score.  Scores range from 1 (worst) to 10 best.  After the second tab comes the title of the movie. Make a program called MovieRanker that reads in the data in ratings.tsv and responds to queries of the following form.  The user inputs two integers, say k and m,  with 0 ≤ k ≤ 2 × 106 and 0 ≤ m ≤ 105.  Your program should then list,  in decreasing order of rating,  the m highest rated movies among those that had at least k reviews.   Your  program  should  loop,  accepting  input  and  producing  lists until at least one of the input numbers is 0.  After each list, it should report the time in milliseconds that it took to produce the list.  A screen shot appears on the next page. Several files are on Vocareum, in addition to ratings.tsv.  The file MaxHeap.java contains  an  implementation  of  a  priority  queue  based  on  a  max  heap.   MovieRating.java  is  a  class  for  storing  a  record  of  movie  information.   Finally,  MovieRanker.java contains starter code with the required input and output statements.


Note:


• Do not solve this problem by sorting the ratings list.



Step by Step Solution

3.47 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

Here is the Java code for the MovieRanker program This program works by first reading the ratings fi... 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

Accounting Information System

Authors: James A. Hall

7th Edition

978-1439078570, 1439078572

More Books

Students also viewed these Programming questions

Question

What attributes should output views possess?

Answered: 1 week ago

Question

Explain the relationship between MRP II and ERP.

Answered: 1 week ago