Multiple choice

Consider a linked list of 'n' elements which is pointed by an external pointer. What is the time taken to delete the element, which is successor of the element pointed to by a given pointer?

  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

If you have a pointer to an element, deleting its successor involves updating the current node's next pointer to skip the successor. This operation is constant time, O(1).