What would be the time complexity if the user tries to insert the element at the end of the linked list (head pointer is known)?
Answer with explanationAnswer: Option C
The answer is b, i.e., O(n). As it is mentioned in the above question that head pointer is known, so to insert the node at the end of the linked list; we have to traverse till the nth node. Therefore, the time complexity would be O(n).
Discuss about the question