Which of the following operations takes the longest time in an unsorted array?

2025

Which of the following operations takes the longest time in an unsorted array?

Answer: C. Searching for an elementIn an unsorted array: Access → O(1) Insert at end → O(1) Delete from end → O(1) Search → O(n) Searching takes the longest time because it may require scanning…

  1. A.

    Deleting from the end

  2. B.

    Accessing an element

  3. C.

    Searching for an element

  4. D.

    Inserting at the end

Attempted by 702 students.

Show answer & explanation

Correct answer: C

In an unsorted array:

Access → O(1)
Insert at end → O(1)
Delete from end → O(1)
Search → O(n)

Searching takes the longest time because it may require scanning every element in the array.

Explore the full course: Niacl Ao It Specialist

Loading lesson…