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

2025

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

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

  1. A.

    O(1)

  2. B.

    O(log n)

  3. C.

    O(n)

  4. D.

    O(n^2)

Attempted by 572 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

Loading lesson…