Getting an error in the output


This is my code

there are a lot of cases that u need to handle in this particular question
algo:

  1. make a even_head , odd_head pointing to LL with even and odd element respectively
  2. even_tail , odd_tail which are tail pointer to even and odd linked list
  3. for the first element of even and odd update the respective heads, make the tail point to the head
  4. when iteration is over
    a. even_tail->next = NULL ( else will go in infinite loop)
    b. check if odd head is NULL : means no odd elements simply return even_head
    c. if even_head == NULL then odd_tail->next = NULL
    else odd_tail->next = even_head
    return odd_head;

https://ide.codingblocks.com/s/209609
refer to this code well commented

but I haven’t understood this…if I had made the linklist and then sort it in that manner in place so where I was goinf wrong…if I go by my method?

the approach is wrong

read the algo heere

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.