First, solve the problem. Then, write the code. John Johnson

Rotate a Linked List

Language Java | Level Intermediate | Category Data structure | September 5, 2015 11:53 pm


Data structure Description

Write a program to rotate the linked list with given pointer. Singly linked list contain the sequence of nodes which each node contain data and link to the next node. Utility function takes the head node and K ( the number of the node need to rotate) and return the rotated list.


Output

   					 

Print the list of items: 1->2->3->4->5->6->7->8->NULL
Print the list of items after pairwise Swap: 2->3->4->5->6->7->8->1->NULL

				    

Comments


No comments available!

Please login to add comments.