What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?

Q & AWhat would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?
Admin Staff asked 4 years ago

What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?
a) O(1)
b) O(n)
c) O(n2)
d) O(n3)

1 Answers
Admin Staff answered 4 years ago

b) O(n)