Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE
Keys 88, 23, 59, 80, 70, 72, 73, 36 are inserted into a hash table of size 10 with h(k) = k mod 10 and linear probing. At which index is 59 stored?
- A. 8
- B. 0
- C. 14
- D. 9
Correct answer: D. 9
Insert in order, moving to the next slot on collision. Final table: [80, 70, 72, 23, 73, –, 36, –, 88, 59]; 59 is at index 9.
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 11 with front = 7 and rear = 5 (rear indexes the last stored element, the queue is…
- Quicksort uses the Lomuto partition with the last element as pivot on [32, 15, 43, 18, 25, 39, 6]. After one partition call, at which…
- Two sorted lists [19, 23, 28, 35] and [5, 12, 22, 29, 32, 35] are merged using the standard merge step. How many element comparisons are…
- Evaluate the postfix expression: 2 1 2 - 6 +
- How many swaps does bubble sort (adjacent swaps, ascending) make on [57, 4, 11, 32, 51, 42, 56, 24]?
- A sorted array holds the 40 values 2, 5, 8, … (step 3). Binary search with mid = ⌊(lo+hi)/2⌋ and 0-based indices looks for 59. How many…