Multiple choice

Consider a linked list of 'n' elements. What is the time taken to insert an element after pointed by some pointers?

  1. O(1)

  2. O(log2 n)

  3. O(n)

  4. O(n log2 n)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Inserting an element after a given node in a linked list only requires updating the next pointers of the current node and the new node. This is an O(1) operation.