added the code to swap two nodes instead of their values but still some end cases has to be solved like when the swapping elements are adjacent to each other and in the start and end of the array