Amazine.com sells everything to everybody. They need to quickly access product i
ID: 3698139 • Letter: A
Question
Amazine.com sells everything to everybody. They need to quickly access product inventories to determine to process sales orders. A hashtable is used to store inventory information for the products. Each inventory record contains the following information: SmallCircle Product name (up to 20 characters) SmallCircle Product description (up to 300 characters) SmallCircle Vendor name (up to 20 characters) SmallCircle Vendor 11-digit product number SmallCircle Quantity available The programmer implementing the hashtable is considering four different hash functions: hash1: hash on the product name hash2: hash on the product description hash3: hash on both the vendor name and product number hash4: hash on both the product name and quantity available Which hash function would likely be most effective? For each of the other hash functions briefly explain why they would be unsuitable.Explanation / Answer
A. The hash function 3 would be the best option. It results in less number of collisions (therefore needs less collision resolution techniques). The reason it results in less number of collisions is that the product number and vendor name both together form a unique entity. The chances of that entity to occur again is very less (as the same vendor doesnt produce products with the same number).
B. Hash function 1 results in a lot of confusion (collisions) as the same product might exist many times (Many vendors might produce the same product).
Hash function 2 is inefficient as it uses a lot of space. Though the product desc. might not be similar across many cases, the space usage is the factor.
Hash function 4 the entity of product name + quantity available might have chances of collision as the same product can be produced by different companies with the same name and same quantity.
The best option would be Hash 3 as the product number and vendor name form a unique entity and result in less collisions.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.