GATE Computer ScienceModerateGATE CS (PYQ pattern)
125 keys are hashed uniformly and independently into 50 chains of a hash table. What are the expected number of keys examined in an unsuccessful search and the expected number of empty chains?
- A. 2.5 keys and about 18.4 empty chains
- B. 2.5 keys and about 4.0 empty chains
- C. 3.5 keys and about 4.0 empty chains
- D. 2.5 keys and about 47.5 empty chains
Correct answer: B. 2.5 keys and about 4.0 empty chains
Unsuccessful search scans a whole chain: alpha = 125/50 = 2.5. A chain is empty with probability (1 - 1/50)^125, so expected empty chains = 50 * 0.98^125 = 4.0.
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- The preorder and inorder traversals of a binary tree are 7 3 1 2 5 4 6 and 1 3 2 7 4 5 6 respectively. What is its postorder traversal?
- int a[] = {2, 4, 6, 8, 10}; int p = a + 1, q = a + 4; printf("%d %d %d", p + q, (q - 2), q - p); What is printed?
- int f(void) { static int c = 0; return ++c; } int main() { int x = f() || f(); int y = f() && f() > 3 ? f() : -f(); printf("%d %d %d", x…
- In a min-heap stored 1-indexed in an array with children of i at 2i and 2i+1, a node at index 77 is replaced by a smaller key and sifted…
- int a[] = {5, 3, 8, 4, 2, 9, 1, 7, 6, 10}; int st[10], top = -1, nge[10]; for (int i = 0; i < 10; i++) nge[i] = -1; for (int i = 0; i <…
- A min-stack keeps an auxiliary stack: a value is pushed on it when it is less than or equal to the current auxiliary top (or it is empty)…