You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time. Bertrand Meyer

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.



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



No comments available!

Please login to add comments.