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?
- A.
Deleting from the end
- B.
Accessing an element
- C.
Searching for an element
- D.
Inserting at the end
Attempted by 272 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.