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 firstname.lastname@example.org. 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.
- Splitting starting N nodes into new Circular Linked List while preserving the old nodes
- Sum of the 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
- Delete all odd or even positioned nodes from Circular Linked List
- Sum and Product of the nodes of a Circular Singly Linked List which are divisible by K
- Delete all Prime Nodes from a 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
- Check if a linked list is Circular Linked List
- Append odd position nodes in reverse at the end of even positioned nodes in a Linked List
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- Deletion from a Circular Linked List
- Circular Linked List | Set 2 (Traversal)