Question 8580 – Algorithms
January 29, 2024Question 10215 – CPU-scheduling
January 30, 2024Question 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.
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.
I and II only
I and III only
II and IV only
I and IV only
None of the above.
Subscribe
Login
0 Comments