Question 8580 – Algorithms

January 29, 2024

GATE 1995

January 30, 2024

Question 8580 – Algorithms

January 29, 2024

GATE 1995

January 30, 2024

Question 11277 – Algorithms

Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?
I. Quick sort runs in Q(n2) time
II. Bubble sort runs in Q(n2) time
III. Merge-sort runs in Q(n2) time
IV. Insertion sort runs in Q(n2) time

Correct Answer: E

Question 416 Explanation: 
Quick sort runs in O(n2) if the input is already in sorted order.
Bubble sort runs in O(n) time if the input is already in sorted order.
Merge sort runs in O(nlogn) time.
Insertion sort runs in O(n) time.
A
I and II only
B
I and III only
C
II and IV only
D
I and IV only
E
None of the above.

Leave a Reply

Your email address will not be published. Required fields are marked *