Searching and Sorting questions

Q31

GATE DA 2026 DASearching and SortingNAT1 mark

Report a problem with Q31

What is wrong?
Let A be a sorted array containing 1000 distinct integers. You perform a recursive binary search on A to find an element y. Suppose each comparison checks whether the middle element computed during the current recursive step is equal to, less than, or greater than y.
The maximum number of comparisons that may have to be performed if y is not an element of A is _______ . (Answer in integer)
Show answer without attempting

Loading the answer…

Q49

GATE DA 2026 DASearching and SortingMSQ2 marks

Report a problem with Q49

What is wrong?
Consider the problem of sorting the given array in ascending order:
P = [1, 2, 3, 5, 4]
Consider two sorting algorithms Bubble Sort (BS) and Insertion Sort (IS).
Let N1 be the total number of comparisons done by BS on the elements of P and N2 be the total number of comparisons done by IS on the elements of P.
Which of the following options is/are correct?
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q27

GATE DA 2025 DASearching and SortingMSQ1 mark

Report a problem with Q27

What is wrong?
For which of the following inputs does binary search take time O(log⁡n)O(\log n) in the worst case?
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q29

GATE DA 2025 DASearching and SortingMSQ1 mark

Report a problem with Q29

What is wrong?
Suppose that insertion sort is applied to the array [1,3,5,7,9,11,x,15,13][1, 3, 5, 7, 9, 11, x, 15, 13] and it takes exactly two swaps to sort the array. Select all possible values of xx.
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q40

GATE DA 2024 DASearching and SortingMCQ2 marks−2/3 if wrong

Report a problem with Q40

What is wrong?
Let F(n)F(n) denote the maximum number of comparisons made while searching for an entry in a sorted array of size nn using binary search.

Which ONE of the following options is TRUE?
Show answer without attempting

Loading the answer…

Q45

GATE DA 2024 DASearching and SortingMCQ2 marks−2/3 if wrong

Report a problem with Q45

What is wrong?
Consider the following sorting algorithms:

(i) Bubble sort
(ii) Insertion sort
(iii) Selection sort

Which ONE among the following choices of sorting algorithms sorts the numbers in the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?
Show answer without attempting

Loading the answer…

0/60 correct0 marks

Related topics in Programming Data Structures and Algorithms