Switch to Dark Mode

JavaScript | Linked List | Question 5

Last Updated : Feb 22, 2025
Discuss
Comments

In a linked list, what is the time complexity for inserting a new node at the beginning?

A

O(1)

B

O(n)

C

O(log n)

D

O(n^2)

Share your thoughts in the comments