Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE
Keys 76, 92, 75, 39, 73, 79, 41, 56, 14 are inserted into a hash table of size 11 with h(k) = k mod 11 and linear probing. At which index is 41 stored?
- A. 4
- B. 8
- C. 10
- D. 6
Correct answer: B. 8
Insert in order, moving to the next slot on collision. Final table: [–, 56, 79, 14, 92, –, 39, 73, 41, 75, 76]; 41 is at index 8.
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
- A circular queue is implemented in an array of size 10 with front = 6 and rear = 6 (rear indexes the last stored element, the queue is…
- Two sorted lists [6, 8, 12, 35] and [4, 11, 17, 20, 25, 29] are merged using the standard merge step. How many element comparisons are made?
- Evaluate the postfix expression: 4 3 5 + 3 -
- How many swaps does bubble sort (adjacent swaps, ascending) make on [33, 25, 8, 52, 16, 15, 22, 24, 10]?
- A sorted array holds the 39 values 2, 5, 8, … (step 3). Binary search with mid = ⌊(lo+hi)/2⌋ and 0-based indices looks for 50. How many…
- Keys 81, 58, 72, 25, 31 are inserted into a hash table of size 10 with h(k) = k mod 10 and linear probing. At which index is 58 stored?