349 views

What is the run-time complexity of inserting a new element at the beginning of a circular, doubly-linked list with a head?

1. $O(1)$
2. $O(\log \text{N})$
3. $O(\text{N})$
4. $O(\text{N}^2)$

This can be done in constant Time

O(1)

We need to change only the links. No need to traverse the linked list hence no loops.