Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The objective of this assignment is to learn how to implement index structures on data stored in the external memories. Assume that we have a
The objective of this assignment is to learn how to implement index structures on data stored in
the external memories.
Assume that we have a relation Employeeid name, bio, managerid The values of id and
managerid are integers each with the fixed sizes of bytes. The values of name and bio are
character strings and take at most and bytes, respectively. Note that as opposed to the
values of id and managerid the sizes of the values of name and bio are not fixed and are between
to bytes. The size of each page is bytes KB The size of each record is less
than the size of a page. Using the provided skeleton code with this assignment, write a C or C
program that creates a hash index file for relation Employee using attribute id Your program
must also enable users to search the created index by providing the id of a record.
The Input File: The input relation is stored in a CSV file, ie each tuple is in a separate
line and fields of each record are separated by commas. Your program must assume that the
input CSV file is in the current working directory, ie the one from which your program is
running, and its name is Employee.csv We have included an input CSV file with this
assignment as a sample test case for your program. Your program must create and search
hash indexes correctly for other CSV files with the same fields as the sample file.
Index File Creation: Your program must read the input Employee relation and build a
linear hash index for the relation using attribute id Your program must store the hash
index in a file with the name EmployeeIndex on the current working directory. You may use
one of the methods explained for storing variablelength records and the method described
on storing pages of variablelength records in our lectures on storage management to store
records and blocks in the index file. They are also explained in Sections and of
Cow Book, respectively. You can reuse your code for Assignment to store pages in the
index file. Your index file must be a binary data file and not a text or CSV file.
Index Parameters: You must use hash function h idmod Your program must
increment the value of n if the average number of records per each page exceeds of the
page capacity.
Main Memory Limitation: During the index creation, your program can keep up to
three pages plus the directory of the hash index in main memory at any time. The
submitted solutions that use more main memory will not get any points.Searching the Index File: After finishing the index creation, your program must accept
an Employee id in its command line and search the index file for all records of the given id
Like index creation, your program may use up to three pages plus the directory of the hash
index in main memory at any time. The submitted solutions that use more main memory
will not get any points for implementing lookup operation. The user of your program may
search for records of multiple ids, one id at a time.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started