Even after odd.... problem


segmentation fault

@bhattanurag426 in your even odd function you are accessing fast->data and slow->data without checking if slow and fast pointer are null or not,that’s why you are getting segmentation fault.

sir still segmentation fault

@bhattanurag426 send me updated code

@bhattanurag426 i guess you wanted to put “&&” in the comparison of while loop at line 47 of your code

sir now it is working but the output is wrong

what i see in your code is some swapping, i don’t think it will give you correct answer.Try to come up with a different approach.

https://ide.codingblocks.com/s/425494 i also tried this but is gives TLE

only some of the test cases are working

there is no need to find mid pointer, simply traverse the list and keep all odds in a separate list and all even in another separate list and just combine odd and even and point the original head towards head of odd list.

ok sir got it…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.