Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the time complexity to count the number of elements in the linked list?

a) O(1)
b) O(n)
c) O(logn)
d) O(n2)

Answer: b
Explanation: To count the number of elements, you have to traverse through the entire list, hence complexity is O(n).

Join The Discussion