GATE Algorithms: Searching, Sorting and Hashing – Previous Year Questions
31 GATE previous year questions on Searching, Sorting and Hashing (Algorithms, Computer Science) with answers and explanations, from every paper.
31 questions worth 44 marks in all (18 1-mark, 13 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.
- GATE 2007 CS Q14 – Which sort has lowest worst-case complexity?
- GATE 2007 CS Q40 – An empty size7 hash table starts at index0, h(x)=(3x+4) mod7. Insert1, 3, 8, 10 with closed hashing. Which table results? “empty” means unused.
- GATE 2007 CS Q50 – An array has an even number n of elements. To find both its minimum and maximum, which comparison-count statement is TRUE?
- GATE 2008 CS Q40 – What minimum asymptotic number of comparisons determines whether an integer appears more than n/2 times in a sorted n-integer array?
- GATE 2009 CS Q11 – What is the number of swaps required to sort n elements using selection sort, in the worst case?
- GATE 2009 CS Q36 – Insert 12, 18, 13, 2, 3, 23, 5, 15 into an empty length10 hash table, using h(k)=k mod10, open addressing and linear probing. Which resultant table is…
- GATE 2021 CS (CS2) Q18 – Find the worst-case number of arithmetic operations in recursive binary search on a sorted n-element array.
- GATE 2015 CS (CS3) Q22 – A hash table with 25 slots stores 2000 elements. Find its load factor α.
- GATE 2015 CS (CS2) Q50 – Which integer hash function distributes keys i=0,…,2020 most uniformly over buckets 0,…,9?
- GATE 2010 CS Q62 – A ten-slot hash table uses h(k)=k mod 10 and linear probing. Its occupied slots are 2:42, 3:23, 4:34, 5:52, 6:46, 7:33; all others are empty. Which…
- GATE 2010 CS Q63 – A ten-slot hash table uses h(k)=k mod 10 and linear probing. Its occupied slots are 2:42, 3:23, 4:34, 5:52, 6:46, 7:33; all others are empty. How many…
- GATE 2013 CS Q16 – What is the tightest upper bound on swaps used by selection sort on n numbers?
- GATE 2012 CS Q49 – Merge sort lexicographically sorts n strings, each of length n. What is the worst-case running time?
- GATE 2016 CS (CS2) Q23 – Algorithms sort in ascending order. On an already ascending input, which are true? I: Quicksort takes (n2). II: Bubblesort takes (n2). III: Mergesort…
- GATE 2014 CS (CS3) Q24 – Quicksort on n array elements always chooses the central array element as pivot. Find the tightest upper bound on worst-case performance.
- GATE 2014 CS (CS3) Q52 – listA contains n > 0 elements sorted in ascending order. Which statement about ProcessArray is correct? int ProcessArray(int *listA, int x, int n) int…
- GATE 2014 CS (CS1) Q24 – Quicksort P sorts ascending using the first element as pivot. Let t₁ and t₂ count its comparisons on [1,2,3,4,5] and [4,1,5,3,2] respectively. Which…
- GATE 2014 CS (CS1) Q49 – Find the minimum comparisons needed to find both minimum and maximum of 100 numbers.
- GATE 2017 CS (CS1) Q58 – Let A be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index i such that…
- GATE 2016 CS (CS1) Q23 – The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
- GATE 2015 CS (CS1) Q14 – Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n ( 2) numbers? In the…
- GATE 2019 CS Q30 – An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that…
- GATE 2019 CS Q50 – Consider the following statements: I. The smallest element in a max-heap is always at a leaf node II. The second largest element in a max-heap is…
- GATE 2026 CS (CS2) Q30 – The keys 5, 28, 19, 15, 26, 33, 12, 17, and 10 are inserted into a hash table using the hash function h(k)=k 9. Collisions are resolved by chaining.…
- GATE 2026 CS (CS1) Q24 – Consider a hash table P[0, 1, , 10] that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function…
- GATE 2025 CS (CS2) Q20 – 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 is…
- GATE 2025 CS (CS2) Q41 – An array A of length n with distinct elements is said to be bitonic if there is an index 1 i n such that A[1..i] is sorted in the non-decreasing order…
- GATE 2025 CS (CS1) Q33 – The pseudocode of a function fun() is given below: Let A[0,...,29] be an array storing 30 distinct integers in descending order. The number of swap…
- GATE 2023 CS Q20 – 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…
- GATE 2022 CS Q16 – 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 1 for…
- GATE 2021 CS (CS1) Q19 – Consider the following array: [23, 32, 45, 69, 72, 73, 89, 97]. Which algorithm out of the following options uses the least number of comparisons…