CSCI-1200 Data Structures — Spring 2022Homework 9 — IMDB Search

 The Internet Movie Database (IMDB) keeps track of data related to films. We have processed some of the
data from https://www.imdb.com/interfaces/ since the full dataset has some interesting problems and is
far too large for us to work with.
Your program will take input from std::cin which constitutes a list of commands. Some of these commands
will describe how your hash table for the assignment will work, and other commands will request output to
std::cout.
The goal is to write our own simple search engine for movie data. In a search, we may have exact information,
or we may only have partial information (more on this later). In order to make our search time-efficient we
will use extra memory in our hash table to store more “keys”.
Movie Data
When your program receives the movies command, it will be given a filename to read from. Each entry in
the file will look like:
Title
Year of Release
Runtime in Minutes
GenreCount GenreList
ActorCount ActorList
RoleCount RoleList
There will be no spaces in any of the data, for example instead of “John Wayne” we would have “John Wayne”.
None of the fields will be blank, and GenreCount, ActorCount, RoleCount will all be ≥ 1. GenreList will
have GenreCount entries, ActorList will have ActorCount entries, and RoleList will have RoleCount
entries. Refer to the sample for more concrete examples.
One strange thing about the data is that instead of the actors having names, they all have strings starting
with “n” which we will refer to as “nconsts”. This is because there might be two actors with the same name,
so we instead use a unique identifier. However, there is another command actors which also gives a filename.
The structure of the actors file is much simpler with each line consisting of:
nconst ActorName
The third major operation is query. After the word query your program can expect input that looks like
an entry from the movie file. However, it is also possible to have unknown values. If the title, runtime, or
year are “?” it means that they are a wildcard and will match any movie. If the GenreCount, ActorCount
or RoleCount are 0, it means they are a wildcard and will match any movie. When your program receives
a query, it should search the hash table (more on that in a moment) and return all results that match. In
order for two GenreLists, ActorLists, or RoleLists to match, they must have the same number of values,
every value must match, and the values must be in the same order.
Choice of Hash Function and Table Implementation
The choice of the hash function is up to you. A good hash function should be fast, O(1) computation, and
provide a random, uniform distribution of keys throughout the table. You may use one of the hash functions
mentioned in lecture, one found on the internet, or one of your own devising. If you choose to download a
hash function from the internet, you must provide the URL in your README and include the source code
with your submission. If the downloaded file requires a copyright notice, you MUST include that notice. Be

有需要的

qq1703105484

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值