Circular Linked List Traversal
Submissions: 7642   Accuracy:

59.21%

  Difficulty: Basic   Marks: 1

Given a circular linked list, your task is to complete the method printList() that prints the linked list.

Input:
The printList function takes a single argument as input the reference pointer to the head of the linked list.
There are multiple test cases and for each test the function will be called separately. 

Output:
For each test function, Circular Linked List should print the data elements. 

Constraints:
1<=T<=50
1<=N<=50

Example:
Input:
2
7
374 363 171 497 282 306 426
2
162 231

Output:
426 306 282 497 171 363 374
231 162

Note : Input items are inserted at the front of linked list that is why output is in reverse order.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shubham Chaudhary
Author: Shubham Chaudhary gfg


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.