STQC-NIELIT SC-B 2021
November 1, 2024Algorithm-Paradigms
November 2, 2024GATE-2024-CS1(Forenoon)
|
Question 17
|
Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass through the array and comparing each element of the array only with its adjacent elements. The worst-case time complexity of this algorithm is
|
both Ο(N) and Ω(N)
|
|
|
Ο(N) but not Ω(N)
|
|
|
Ω(N) but not Ο(N)
|
|
|
neither Ο(N) nor Ω(N)
|
Correct Answer: A
