Data Structures & AlgorithmsHardGATE CS · Product placement
Keys 110, 52, 100, 101, 53, 74, 96 are inserted in this order into an empty table of size 13 using quadratic probing: probe i goes to (k mod 13 + i²) mod 13 for i = 0, 1, 2, …. In which slot is 96 placed?
- A. 9
- B. 8
- C. 7
- D. 5
Correct answer: B. 8
96 hashes to 5. Offsets 0, 1, 4, 9, … are added to the home slot; the first free slot is 8 (probe i = 4). Linear probing would have placed it in slot 5.
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
- For the binary array [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1], replace 0 by −1 and use prefix sums with a first-occurrence map. What is the…
- XOR linked list: each node stores link = address(prev) XOR address(next). Which statement is correct?
- Evaluate the postfix expression 1 9 9 ÷ 4 − 7 + − (all divisions are exact). What is its value, and what is the maximum number of operands…
- Floyd's cycle detection on a list whose last node links back into the list. What does this print (meeting value, cycle-start value, cycle…
- Z-array: z[i] is the length of the longest common prefix of s and s[i:], with z[0] defined as 0. What is printed? python s = "abaabaaba" z…
- Kadane's algorithm is applied to an array whose elements are ALL negative, using the version cur = max(x, cur + x), best = max(best, cur)…