@@ -0,0 +1,1639 @@
+// Java program to pairwise swap elements of a linked list%0Aclass LinkedList%0A%7B%0A%09Node head; // head of list%0A%0A%09/* Linked list Node*/%0A%09class Node%0A%09%7B%0A%09%09int data;%0A%09%09Node next;%0A%09%09Node(int d) %7Bdata = d; next = null; %7D%0A%09%7D%0A%0A%09void pairWiseSwap(Node prev, Node current)%0A%09%7B%0A%09%09if(current != null && current.next!=null)%7B%0A%09%09    Node temp=current.next;%0A%09%09    current.next=current.next.next;%0A%09%09    temp.next=current;%0A%09%09    if(prev!=null)%7B%0A%09%09        prev.next=temp;%0A%09%09    %7Delse%7B%0A%09%09        head=temp;%0A%09%09    %7D%0A%09%09    %0A%09%09%7Delse%7B%0A%09%09    return;%0A%09%09%7D%0A     pairWiseSwap(current,current.next);%0A%0A%09%7D%0A%0A%09%09%09%09%09%0A%09/* Utility functions */%0A%0A%09/* Inserts a new Node at front of the list. */%0A%09public void push(int new_data)%0A%09%7B%0A%09%09/* 1 & 2: Allocate the Node &%0A%09%09%09%09Put in the data*/%0A%09%09Node new_node = new Node(new_data);%0A%0A%09%09/* 3. Make next of new Node as head */%0A%09%09new_node.next = head;%0A%0A%09%09/* 4. Move the head to point to new Node */%0A%09%09head = new_node;%0A%09%7D%0A%0A%09/* Function to print linked list */%0A%09void printList()%0A%09%7B%0A%09%09Node temp = head;%0A%09%09while (temp != null)%0A%09%09%7B%0A%09%09System.out.print(temp.data+%22 %22);%0A%09%09temp = temp.next;%0A%09%09%7D %0A%09%09System.out.println();%0A%09%7D%0A%0A%09/* Driver program to test above functions */%0A%09public static void main(String args%5B%5D)%0A%09%7B%0A%09%09LinkedList llist = new LinkedList();%0A%0A%09%09/* Created Linked List 1-%3E2-%3E3-%3E4-%3E5 */%0A%09%09llist.push(5);%0A%09%09llist.push(4);%0A%09%09llist.push(3);%0A%09%09llist.push(2);%0A%09%09llist.push(1);%0A%09%09%0A%09%09System.out.println(%22Linked List before calling pairWiseSwap() %22);%0A%09%09llist.printList();%0A%09%09%0A%09%09llist.pairWiseSwap(null,llist.head);%0A%09%09%0A%09%09System.out.println(%22Linked List after calling pairWiseSwap() %22);%0A%09%09llist.printList();%0A%09%7D%0A%7D %0A/* This code is contributed by Rajat Mishra */%0A

Create PairwiseSwapElementsOfAGivenLinkedList.java