***PLEASE SHOW ALL WORK AND COMMANDS FOR HOW TO DO IN SAGE APPLICATION***
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.
a)
b) If a visitor finds the hash generated spot is already assigned then we would assign the space
So if 0 is assigned and it is filled then 1 is allotted and so on. If 31 is assigned and it is occupied then 0 should be allotted.
Hope this was helpful. Please do leave a positive rating if you liked this answer. Thanks and have a good day!
Get Answers For Free
Most questions answered within 1 hours.