Write a function to count the number of nodes in a singly linked list. Discuss the approach and complexity of your solution.

icon
Related questions
Question
Write a function to count the number of nodes in a singly linked list. Discuss the approach
and complexity of your solution.
Transcribed Image Text:Write a function to count the number of nodes in a singly linked list. Discuss the approach and complexity of your solution.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer