A parking lot has 31 visitor spaces, numbered from 0 to 30. Visitors are assigned parking spaces using the hashing function h(k) = k mod 31, where k is the number formed from the first three digits on...


C++


I really need help with part C. Please.


A parking lot has 31 visitor spaces, numbered from 0 to 30. Visitors are assigned parking spaces using<br>the hashing function h(k) = k mod 31, where k is the number formed from the first three digits on a<br>visitor's license plate.<br>a) Which spaces are assigned by the hashing function to cars that have these first three digits on<br>their license plates: 317, 918, 007, 100, 111, 310?<br>b) Describe a procedure visitors should follow to find a free parking space when the space they are<br>assigned is occupied.<br>c) A large parking-systems company would like to automate your assignment procedure forself-<br>parking cars. You have been hired to implement a

Extracted text: A parking lot has 31 visitor spaces, numbered from 0 to 30. Visitors are assigned parking spaces using the hashing function h(k) = k mod 31, where k is the number formed from the first three digits on a visitor's license plate. a) Which spaces are assigned by the hashing function to cars that have these first three digits on their license plates: 317, 918, 007, 100, 111, 310? b) Describe a procedure visitors should follow to find a free parking space when the space they are assigned is occupied. c) A large parking-systems company would like to automate your assignment procedure forself- parking cars. You have been hired to implement a "simple" proof-of-concept program in C++, for now customers will enter their 3 digit plate numbers and your software will assign a parking space. Your implementation should a find a free parking space if the original assigned space is occupied. If no spaces are free, your algorithm should say so. You need to encapsulate(embed) your algorithm in a function. You may create as many functions as you need to get the job done. Below is a starting point. const int N =31; // N parking spaces bool parking[N]; // the garage void EmptyTheLot(bool parking[], int N) { for(int i=0; i<>
(а)<br>For the number 100,<br>A lot has 31 visitor spaces from 0 to 30.<br>31)100(3<br>Consider the hashing function,<br>93<br>h(k)= k mod 31<br>%3D<br>(-)<br>Here k is the number formed from the first 3digits.<br>7<br>Consider the cars have their first 3 digits on their license plates are,<br>100 = 7(mod31)<br>317, 918, 007, 100, 111 and 310.<br>The objective is to find the places that are assigned by the hashing function.<br>Hence, for the number 100, the car has 7th<br>space.<br>The hashing function can be written as,<br>h(k) = k mod 31.<br>For the number 111,<br>This means that for every number to find the modulo 31.<br>31)111(3<br>So, for the number 317,<br>93<br>31)317(10<br>(-)<br>31<br>18<br>(-)<br>111=|18(mod31)<br>07<br>00<br>Hence, for the number 111, the car has 18

Extracted text: (а) For the number 100, A lot has 31 visitor spaces from 0 to 30. 31)100(3 Consider the hashing function, 93 h(k)= k mod 31 %3D (-) Here k is the number formed from the first 3digits. 7 Consider the cars have their first 3 digits on their license plates are, 100 = 7(mod31) 317, 918, 007, 100, 111 and 310. The objective is to find the places that are assigned by the hashing function. Hence, for the number 100, the car has 7th space. The hashing function can be written as, h(k) = k mod 31. For the number 111, This means that for every number to find the modulo 31. 31)111(3 So, for the number 317, 93 31)317(10 (-) 31 18 (-) 111=|18(mod31) 07 00 Hence, for the number 111, the car has 18" space|. 07 317 = 7(mod 31) Hence, for the number 317, the car has 7th space. For the number 310, 31)310(10 For the number 918, 31 31)918(29 (-) 62 00 (-) 310 = |0(mod 31) 298 279 Hence, for the number 310, the car has 0" space. (-) 19 918 =|19(mod31) Step 3 Hence, for the number 918, the car has 19th space. (b) The objective is to describe a procedure visitor should follow to find the parking space. For the number 007, For this, use linear probing method. When we face with a location which already is filled then we 007 = 7(mod31)| could give that visitor the next position. Hence, for the number 007, the car has 7th space This method is known as linear probing.
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here