GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2024 set1

GATE 2024 set1 · CS · MCQ · 1 mark · Algorithms › Asymptotic Notation

GATE 2024 set1 Computer Science and Information Technology question: Given an integer array of size N, we want to check if the array is sorted (in either…

Given an integer array of size , 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

  1. (A)

    both and

  2. (B)

    but not

  3. (C)

    but not

  4. (D)

    neither nor

Show answer

Official answer: A

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion