GATE CS 2024, set 1 · Question 17 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
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
- (A) both O(N) and Ω(N)
- (B) O(N) but not Ω(N)
- (C) Ω(N) but not O(N)
- (D) neither O(N) nor Ω(N)
Answer
Answer (A)
Answer from the official GATE CS 2024 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes