What is the time complexity of finding the length of a singly linked list by traversing?
O(n log n)
O(n log n^2)
To find no of elements in a single linked list, we have to traverse through all the nodes, till we reach a node whose next pointer is equal to NULL. so it is O(n).
Back To Top