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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- 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 the even 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 odd or even positioned nodes from Circular Linked List
- Sum and Product of nodes with value as even digit sum in Circular Linked List
- Remove all the Even Digit Sum Nodes from a Circular Singly Linked List
- Remove all Fibonacci Nodes from a Circular Singly Linked List
- Delete all Prime 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 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
- 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
- Circular Linked List | Set 2 (Traversal)
- Reverse a circular linked list
- Deletion from a Circular Linked List