An event company asks you to design the data structure and program prototype for their running event system. The participant for the running event is expected to reach more than 1000 in various categories. You decided to use hashing function method to store the information for each participant's BIB number in the hash table. To begin the problem solving, suppose that 10 registered runners need to be stored in a hash table, HT, with a size of 13. The sample BIB number of the runners are: 101, 102, 103, 104, 107, 111, 121, 217, 157, and 185. Furthermore, you set the hash function to determine the index of the participant in the HT as: hash (BIB) BIB % table size (or 13) However, if the hash index given by hash(BIB) is already occupied (collision), the linear probing hash function will be used as: hash(BIB) (Hash(BIB)+1) % 17 and, further collision with hash function: hash(BIB) = (Hash (BIB)+2) % 17 or, hash(BIB) = (Hash(BIB) + n) % 17, where n is probe increment. Refer to the given function description. According to the above requirements, create a program to 1. store the participant's BIB number in the hash table, and 2. find a bib number 3. print out the content of the hash table. Given the description of the following function: /* Hash function to calculate the index based on the given bib, linear probe and Hash Table size, tableSize bibitablesize @param bib is the number of a participant @param probe if probe is 0 then index -else if probe>0 then index @param table Size - HT size @return index (hash (bib) +probe) #17 +/ int Hash (int bib, int probe, int tableSize) {

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

P2

Case study:
An event company asks you to design the data structure and program prototype for their running
event system. The participant for the running event is expected to reach more than 1000 in
various categories. You decided to use hashing function method to store the information for each
participant's BIB number in the hash table.
To begin the problem solving, suppose that 10 registered runners need to be stored in a hash
table, HT, with a size of 13. The sample BIB number of the runners are: 101, 102, 103, 104, 107,
111, 121, 217, 157, and 185.
Furthermore, you set the hash function to determine the index of the participant in the HT as:
hash (BIB) = BIB % table size (or 13)
However, if the hash index given by hash(BIB) is already occupied (collision), the linear probing
hash function will be used as:
hash (BIB) = (Hash (BIB)+1) % 17
and, further collision with hash function:
hash (BIB) = (Hash(BIB)+2) % 17
or, hash(BIB) = (Hash (BIB) + n) % 17, where n is probe increment. Refer to the given function
description.
According to the above requirements, create a program to
1. store the participant's BIB number in the hash table, and
2. find a bib number
3. print out the content of the hash table.
Given the description of the following function:
1+
Hash function to calculate the index based on the given bib,
linear probe and Hash Table size, tableSize
@param bib is the number of a participant
@param probe if probe is 0 then index
bibitablesize
-else if probe>0 then index (hash (bib) +probe) #17
@param table Size - HT size
@return index
+/
int Hash (int bib, int probe, int tableSize) {
}
Transcribed Image Text:Case study: An event company asks you to design the data structure and program prototype for their running event system. The participant for the running event is expected to reach more than 1000 in various categories. You decided to use hashing function method to store the information for each participant's BIB number in the hash table. To begin the problem solving, suppose that 10 registered runners need to be stored in a hash table, HT, with a size of 13. The sample BIB number of the runners are: 101, 102, 103, 104, 107, 111, 121, 217, 157, and 185. Furthermore, you set the hash function to determine the index of the participant in the HT as: hash (BIB) = BIB % table size (or 13) However, if the hash index given by hash(BIB) is already occupied (collision), the linear probing hash function will be used as: hash (BIB) = (Hash (BIB)+1) % 17 and, further collision with hash function: hash (BIB) = (Hash(BIB)+2) % 17 or, hash(BIB) = (Hash (BIB) + n) % 17, where n is probe increment. Refer to the given function description. According to the above requirements, create a program to 1. store the participant's BIB number in the hash table, and 2. find a bib number 3. print out the content of the hash table. Given the description of the following function: 1+ Hash function to calculate the index based on the given bib, linear probe and Hash Table size, tableSize @param bib is the number of a participant @param probe if probe is 0 then index bibitablesize -else if probe>0 then index (hash (bib) +probe) #17 @param table Size - HT size @return index +/ int Hash (int bib, int probe, int tableSize) { }
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Hash Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education