Which of the following data structures provides efficient random access using an index?

Options

  • A. Array
  • B. Singly Linked List
  • C. Stack implemented only with linked nodes
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. Array

Detailed Explanation

An array provides efficient random access because its elements occupy contiguous memory and an index can be used to calculate an element address directly. Accessing A[i] is normally O(1). In a singly linked list, elements are connected through pointers, so reaching the element at a particular index generally requires traversing preceding nodes and takes O(n). This difference is a fundamental distinction between arrays and linked lists and is frequently tested in data-structure examinations.