What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?

Q & AWhat would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?
Admin Staff asked 4 years ago

What would be the asymptotic time complexity to add a node at the end of the singly linked list, if the pointer is initially pointing to the head of the list?
a) O(1)
b) O(n)
c) θ(n)
d) θ(1)

1 Answers
Admin Staff answered 4 years ago

c) θ(n)