Accessing the nth element of a singly linked list takes time:

2025

Accessing the nth element of a singly linked list takes time:

  1. A.

    O(1)

  2. B.

    O(log n)

  3. C.

    O(n)

  4. D.

    O(n^2)

Attempted by 127 students.

Show answer & explanation

Correct answer: C

A singly linked list must be traversed node by node to reach the nth element, so access takes O(n) time.

Explore the full course: Coding For Placement