What is the worst-case time complexity of insertion in a singly linked list ?

2025

What is the worst-case time complexity of insertion in a singly linked list ?

  1. A.

    O(1)

  2. B.

    O(log n)

  3. C.

    O(n)

  4. D.

    O(n2)

Attempted by 144 students.

Show answer & explanation

Correct answer: C

Insertion in a singly linked list requires traversing the list to find the correct position. In the worst case, this involves visiting all n nodes, leading to O(n) time complexity.

Explore the full course: Niacl Ao It Specialist