Swap given nodes in a Doubly Linked List without modifying data
Given a doubly linked list having all unique elements and two keys X and Y, the task is to swap nodes for two given keys by changing links only. Note: It may be considered that X and Y are always present in the list. Examples: Input: list = 1 <-> 8 <-> 7 <-> 9 <-> 4, X = 1, Y