Data Structures & AlgorithmsModerateIBM · Deloitte pattern
1800 keys are stored in a hash table with 600 slots using separate chaining and simple uniform hashing. About how many key comparisons does a successful search make on average?
- A. 3
- B. 4
- C. 1.5
- D. 2.5
Correct answer: D. 2.5
Load factor α = 1800/600 = 3. A successful search scans about half of the other keys in its chain plus itself: 1 + α/2 = 2.5. An unsuccessful search would scan a whole chain, α = 3.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many distinct non-empty substrings does the string ABAB have?
- What is the KMP failure (LPS) array for the pattern AABAACAABAA?
- The reversal algorithm rotates an array LEFT by k: reverse the first k elements, reverse the rest, then reverse the whole array. What is…
- Which statement about a doubly linked list compared with a singly linked list is FALSE?
- How many of these statements are correct? (i) Merge sort is stable. (ii) Heap sort runs in O(n log n) even in the worst case. (iii) Quick…
- What is the time complexity of this code fragment? c int count = 0; for (int i = 1; i < n; i = 2) for (int j = 0; j < i; j++) count++;