ProgrammingModerate

Which operation is O(1) in a C array, but O(n) in a singly linked list when the head is given?

  1. A. Insertion at the head of a list
  2. B. Access to the i-th element by index
  3. C. Removal of the head node of a list
  4. D. Reading the head pointer's value

Correct answer: B. Access to the i-th element by index

Arrays compute the address of element i directly, while a list must follow i links. Head insertion and removal touch only the head.

More C Programming questions

Exams that ask this topic