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
Quiz Practice:
A. Array
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.