首页
编程语言
数据库
网络开发
Algorithm算法
移动开发
系统相关
金融统计
人工智能
其他
首页
>
> 详细
讲解CSCI-1200、C++程序语言辅导、IMDB Search辅导、讲解c/c++ 辅导留学生 Statistics统计、回归、迭代|帮
CSCI-1200 Data Structures — Spring 2020
Homework 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
sure to observe any copyright restrictions on the use of the code. In your README file, describe your hash
function and table implementation.
You may write as many classes as you feel are necessary, however you must have exactly one hash table and the
representation must be a vector
> > where QUERY is your representation
of a single query (may have wildcards), and MOVIE_DATA should be all the information about one movie.
To handle collisions, use one of the open addressing methods described in lecture (linear probing, quadratic
probing, or secondary hashing). Linear probing is the simplest of these three methods. Since you are not
separate chaining, you might be confused about why the value has a list. Each entry in the hash table
consists of a query, and a list of all movies that match that specific query. You should not add a movie’s data
to a particular list in the hash table unless it matches the corresponding key (query). You will receive a
significant penalty if you do not follow this structure.
One of your challenges will be figuring out how to hash the queries. We will not be picky about which
approach you take for the value, but it is strongly recommended that your values in your hash table are
pointers, since you will otherwise duplicate the movie data many times and the duplicates may cause you to
run out of memory quickly, particularly on Submitty. Hint: If you use an appropriate STL data structure to
hold the data in main, then you will not need to use new/delete in your code.
The key in your hash table should be a unique identifier of a query, which is based on movie data. Where this
gets interesting is that in addition to a query consisting of the full movie data (no wildcards), you will need
to hash every partial version of a movie object (with one or more wildcards), since a given movie can be an
answer in approximately 64 different queries! Recall from the description above of the query command that
you may be given only some information with others left as unknowns. If implemented correctly, constructing
the hash table should be where most of the work happens, with a lookup being very quick.
For example, the second query in top250 example input.txt looks for any movie from 1994, so all movies in
the dataset that have a year of 1994 should be values associated with the QUERY corresponding to the partial
movie data where everything is empty except the year, which is set to 1994. Representing partial queries
is part of the challenge in this assignment though one approach is simply to use empty strings/containers.
Generating all of the partial queries may be made easier by using the code in starter code.cpp which generates
all possible sequences of 6 numbers that are each 0 or 1.
You may not use std::hash, std::unordered map, std::unordered set, std::map or similar STL functions/containers.
Exception: You can use a map to store actor data, but not movie data.
When implementing the hash table, set the initial size of the table. As you enter data in the table, calculate
the occupancy ratio:
occupancy =
number of unique key entries
table size
When the occupancy >than some fixed level, double the size of the table and rehash the data. Describe your
re-sizing method in the hash table section of the README file.
Input/Output & Basic Functionality
The program should read a series of commands from std::cin (STDIN) and write responses to std::cout
(STDOUT). Sample input and output files have been provided. You can redirect the input and output
to your program using the instructions in the section Redirecting Input & Output found at http:
//www.cs.rpi.edu/academics/courses/spring20/csci1200/other_information.php
Your program should accept the following commands:
• movies filename - Read movie data from filename.
• actors filename - Read actor data from filename.
2
• table size N - this is an optional command. N is an integer. It is the initial hash table size. If it does
not appear in the command file, the initial table size should be set to 100.
• occupancy f - this is an optional command. f is a float. When the occupancy goes above this level, the
table should be resized. If it does not appear in the command file, the initial level should be set to 0.5.
• query query data - Search the movie data for any matches to query data.
• quit - Exit the program.
You may assume that if table size or occupancy appear, they will appear before movies. You can also
assume that movies and actors will appear before any query commands.
For output to queries, if matches are found, the program will print the number of matches and the corresponding
movie data. Otherwise, the program will print “No results for query.” Since the ordering will depend on
your hash function, you are not required to print the results of a query in any particular order. One subtle
detail is that when outputting movie data you should use the actual names of actors instead of their nconsts.
You are not explicitly required to create any new classes when completing this assignment, but please do so as
it will improve your program design. We expect you to use const and pass by reference/alias as appropriate
throughout your assignment.
Submission
Use good coding style and detailed comments when you design and implement your program. Please use
the provided template README.txt file for any notes you want the grader to read, including work for extra
credit. You must do this assignment on your own, as described in the “Collaboration Policy & Academic
Integrity”. If you did discuss the problem or error messages, etc. with anyone, please list their names in your
README.txt file.
3
联系我们
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-21:00
微信:codinghelp
热点文章
更多
mgt202辅导 、讲解 java/pytho...
2025-06-28
讲解 pbt205—project-based l...
2025-06-28
辅导 comp3702 artificial int...
2025-06-28
辅导 cs3214 fall 2022 projec...
2025-06-28
辅导 turnitin assignment讲解...
2025-06-28
辅导 finite element modellin...
2025-06-28
讲解 stat3600 linear statist...
2025-06-28
辅导 problem set #3讲解 matl...
2025-06-28
讲解 elen90066 embedded syst...
2025-06-28
讲解 automatic counting of d...
2025-06-28
讲解 ct60a9602 functional pr...
2025-06-28
辅导 stat3600 linear statist...
2025-06-28
辅导 csci 1110: assignment 2...
2025-06-28
辅导 geography调试r语言
2025-06-28
辅导 introduction to informa...
2025-06-28
辅导 envir 100: introduction...
2025-06-28
辅导 assessment 3 - individu...
2025-06-28
讲解 laboratory 1讲解 留学生...
2025-06-28
辅导 ct60a9600 renewable ene...
2025-06-28
辅导 economics 140a homework...
2025-06-28
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 99515681 微信:codinghelp
© 2024
www.7daixie.com
站长地图
程序辅导网!