GATE 2026 Algorithms PYQs | DIVIDE AND CONQUER

Last Updated :
Discuss
Comments

Question 1

There are n unsorted arrays: A 1 , A 2 , …, A n . Assume that n is odd. Each of A 1 , A 2 , …, A n  contains n distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of A 1 , A 2 , …, A n  is
GATE CSE 2019 - [2Marks] (MCQ)


  • O(n)

  • O(n log n)

  • O(n2)

  • Ω(n2 log n)

Question 2

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 merge sort algorithm will carry out a total of 7 merge operations. A merge operation on sorted left array L and sorted right array R is said to be void if the output of the merge operation is the elements of array L followed by the elements of array R. The number of void merge operations among these 7 merge operations is ________. (answer in integer) [GATE 2026 || SET-2 NAT || 2-mark]

Question 3

Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A, key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations

When A contains n elements, which one of the following statements about the worst case running time of these two operations is TRUE?
GATE CSE 2023 - [2Marks] (MCQ)


  • Both Extract-Max(A) and Insert(A, key) run in O(1)

  • Both Extract-Max(A) and Insert(A, key) run in O(logn).


  • Extract-Max(A) runs in O(1) whereas Insert(A, key) runs in O(n)

  • Extract-Max(A) runs in O(1) whereas Insert(A, key) runs in O(logn)

Question 4

Which one of the following sequences when stored in an array at locations A[1],…,A[10] forms a max-heap?
GATE CSE 2023 - [1Marks] (MCQ)


  • 23,17,10,6,13,14,1,5,7,12

  • 23,17,14,7,13,10,1,5,6,12

  • 23,17,14,6,13,10,1,5,7,15

  • 23,14,17,1,10,13,16,12,7,5


Question 5

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n
GATE CSE 2021,SET2 - [1Marks] (MCQ)


  • Θ(n)

  • Θ(n2)

  • Θ(✓n​)

  • Θ(log2n)

Question 6

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 minimum and maximum values in an arbitrary array of n elements. Which one of the following choices is correct?
GATE CSE 2021,SET1 - [1Marks] (MCQ)


  • t>n and t ≤ 3 ⌈n/2​⌉

  • t > 3⌈n/2​⌉ and t ≤ 2n−2

  • t>2n−2

  • t > ⌈log2​(n)⌉ and t ≤ n

Question 7

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 (among the array elements) to sort the above array in ascending order?
GATE CSE 2021,SET1 - [1Marks] (MCQ)


  • Quicksort using the last element as pivot

  • Selection sort

  • Merge sort

  • Insertion sort

Question 8

Let G be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in G has even weight.
Which of the following statements is/are TRUE for every such graph G?
GATE CSE 2024,SET2 - [2Marks] (MCQ)

  • All edges in G have even weight.

  • In each cycle C in G, all edges in C have even weight.

  • All edges in G have even weight OR all edges in G have odd weight.

  • In each cycle C in G, either all edges in C have even weight OR all edges in C have odd weight.

Question 9

The number of distinct minimum-weight spanning trees of the following graph is ______.

397780653
.

GATE CSE 2024,SET2 - [2Marks] (NAT)

Question 10

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 the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is
GATE CSE 2019 - [1Marks] (NAT)


Tags:

There are 21 questions to complete.

Take a part in the ongoing discussion