A hash function h(key) = key mod 7 with linear probing is used to insert the keys 44, 45, 79, 55, 91, 18, 63 into a table indexed 0 to 6. What will be the location of key 18?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 5
Explanation
44 → 2, 45 → 3, 79 → 2 → 4, 55 → 6, 91 → 0, 18 → 4 (taken) → 5. Key 18 lands in slot 5.
More Data Structures and Algorithms questions
- Match each graph algorithm with its time complexity (n vertices, m edges). List I: A. Bellman-Ford, B. Kruskal's algorithm, C. Floyd-Warsha…
- The reverse Polish notation of the infix expression [A * {B + C * (D + E)}] / {F * (G + H)} is
- With preconditions a > 1 and a < b (no overflow): int x = 0; int p = 1; while (p < b) { p = p * a; x = x + 1; } When the loop ends, x in te…
- A complete -ary tree is a tree in which each n I node has children or no children. Let be the L number of internal nodes and be the number…
- In a binary max heap containing numbers, the smallest element can be found in ____ time.
- If algorithm A and another algorithm B take −− log (n) √n 2 and microseconds, respectively, to n solve a problem, then the largest size of…