Question 1
Open questionIn a singly linked list, what is the time complexity to insert a node at the beginning?
A
A: O(1)
B
B: O(n)
C
C: O(log n)
D
D: O(n²)
Answer and explanation
Correct Answer: A — A: O(1)
Inserting at the beginning takes constant time O(1) as we only update the head pointer.
