PadhaikoAll subjects

Past exam question: 2077 Chaitra (Regular), Q7

Data Structure and Algorithms · 8 marks

Open in the Padhaiko app

Topic: Searching Algorithms

Question

Define collision. Insert the keys 30, 15, 69, 28, 49, 58, 79 and 91 using quadratic probing method. The hash function is : h(key) = key%10 where 10 is the table size.

Solution

Definition of Collision: A collision occurs when two or more distinct keys produce the same home slot under the hash function ( for ).

Quadratic Probing Trace (, ):

Final Hash Table:

Index0123456789
Key309158497915——2869
Answer:

Final hash table (slots 0..9): [30, 91, 58, 49, 79, 15, —, —, 28, 69].

All past exam questions for Data Structure and Algorithms