Close

Pair swapping in a linked list

Given a singly linked list, we have to swap the adjacent nodes in it. For example some input/output samples are given below Input                              output ————————————————- 1->2->3->4->X                      2->1->4->3->X 1->2->3->4->5->X      …