Given a circular linked list, count number of nodes in it. For example, the output is 5 for below list.
We use the concept used in Circular Linked List | Set 2 (Traversal). While traversing, we keep track of count of nodes.
This article is contributed by Rishabh jain. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Splitting starting N nodes into new Circular Linked List while preserving the old nodes
- Sum of the nodes of a Circular Linked List
- Delete all odd nodes of a Circular Linked List
- Exchange first and last nodes in Circular Linked List
- Delete all the even nodes of a Circular Linked List
- Sum and Product of nodes with value as even digit sum in Circular Linked List
- Delete all odd or even positioned nodes from Circular Linked List
- Delete all Prime Nodes from a Circular Singly Linked List
- Remove all the Even Digit Sum Nodes from a Circular Singly Linked List
- Sum and Product of the nodes of a Circular Singly Linked List which are divisible by K
- Remove all Fibonacci Nodes from a Circular Singly Linked List
- Remove all even parity nodes from a Doubly and Circular Singly Linked List
- Count of Prime Nodes of a Singly Linked List
- Circular Queue | Set 2 (Circular Linked List Implementation)
- Convert singly linked list into circular linked list