Write an algorithm to count the no of nodes in the singly linked list
Answers
Answered by
1
❥︎ANSWER
- Write an algorithm to count the no of nodes in the singly linked list.
- Define a node current which will initially point to the head of the list.
- Declare and initialize a variable count to 0.
- Traverse through the list till current point to null.
- Increment the value of count by 1 for each node encountered in the list.
❥︎THANKS
I hope it will help you.
Similar questions
Economy,
2 days ago
Business Studies,
2 days ago
Math,
4 days ago
Hindi,
8 months ago
Social Sciences,
8 months ago
Hindi,
8 months ago