Today we will be discussing the algorithm to Exchange First and Last nodes in Circular Linked List . But, if you are unfamiliar with the concepts of circular linked list then refer to this link. Suppose we have circular linked list 1->2->3->4 and 4 points to 1. Then after swapping the first and last node the circular linked list will look like 4->2->3->1 and 1 points to 4. Now, let's discuss the procedure:
Procedure
1. First we will make a circular linked list.
2. Now we will make a variable which will point to the first node.
3. Then we will make another variable which will point to the last node.