GATE 2023
October 3, 2023Compiler-Design
October 3, 2023UGC NET CS 2011 June-Paper-2
Question 24 |
Consider a hash table of size m = 10000 and the hash function h(k) = ⌊m(kA mod 1)’⌋ for A=(√5 – 1)/2 . The location to the key k=123456 is
46 | |
47 | |
41 | |
43 |
Question 24 Explanation:
Given data,
— size m=10000
— hash function h(k) = ⌊m(kA mod 1)’⌋
— A=(√5 – 1)/2
— key k=123456 location =?
— size m=10000
— hash function h(k) = ⌊m(kA mod 1)’⌋
— A=(√5 – 1)/2
— key k=123456 location =?
Step-1: Find out h(123456) = ⌊(10000 * (123456 * (√5 − 1) / 2) mod 1)⌋
= ⌊(10000 * (76300.004115 mod 1)⌋
= ⌊(10000 * (.004115))⌋
= ⌊41.15⌋
= 41
Correct Answer: C
Question 24 Explanation:
Given data,
— size m=10000
— hash function h(k) = ⌊m(kA mod 1)’⌋
— A=(√5 – 1)/2
— key k=123456 location =?
— size m=10000
— hash function h(k) = ⌊m(kA mod 1)’⌋
— A=(√5 – 1)/2
— key k=123456 location =?
Step-1: Find out h(123456) = ⌊(10000 * (123456 * (√5 − 1) / 2) mod 1)⌋
= ⌊(10000 * (76300.004115 mod 1)⌋
= ⌊(10000 * (.004115))⌋
= ⌊41.15⌋
= 41
Subscribe
Login
0 Comments