Searching Sorting and Hashing
Study notes are awaiting editorial approval. You can still practise the reviewed questions below.
Related previous-year questions
Practise this topic- 2026 · Consider a hash table $P[0, 1, \dots, 10]$ that is initially empty. The hash table is maintained using open addressing with linear probing. The hash f
- 2026 · The keys 5, 28, 19, 15, 26, 33, 12, 17, 10 are inserted into a hash table using the hash function $h(k) = k \bmod 9$. The collisions are resolved by c
- 2026 · Consider an array $A = [10, 7, 8, 19, 41, 35, 25, 31]$. Suppose the merge sort algorithm is executed on array $A$ to sort it in increasing order. The
- 2025 · Consider an unordered list of $N$ distinct integers. What is the minimum number of element comparisons required to find an integer in the list that i
- 2025 · The pseudocode of a function fun() is given below: ```c fun(int A[0,\dots,n-1]){ for i=0 to n-2 for j=0 to n-i-2 if (A[j]>A[j+1]) then swap A[j]
- 2025 · In a double hashing scheme, $h_1(k) = k \bmod 11$ and $h_2(k) = 1 + (k \bmod 7)$ are the auxiliary hash functions. The size $m$ of the hash table is 1
- 2023 · An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of colli
- 2022 · Suppose we are given $n$ keys, $m$ hash table slots, and two simple uniform hash functions $h_1$ and $h_2$. Further suppose our hashing scheme uses $h
- 2021 · Let P be an array containing $n$ integers. Let $t$ be the lowest upper bound on the number of comparisons of the array elements, required to find the
- 2021 · Consider the following array. | 23 | 32 | 45 | 69 | 72 | 73 | 89 | 97 | | --- | --- | --- | --- | --- | --- | --- | --- | Which algorithm out of the
- 2021 · Consider a dynamic hashing approach for 4-bit integer keys: 1. There is a main hash table of size 4. 2. The 2 least significant bits of a key is used
- 2020 · Consider a double hashing scheme in which the primary hash function is $h_1(k) = k \bmod 23$, and the secondary hash function is $h_2(k) = 1 + (k \bmo