Even after odd linked list

i am doing the even after odd but my test case 1 and 4 are coming wrong answer. please take a look at my code.

Hello @raginibhayana99 could you please explain your approach so that we can can find the error.

Hello @raginibhayana99 your code is not giving the correct result because you are not able to maintain the relative order:
like for the test case:
4
1 5 2 4
the output should be ;
1 5 2 4