created two lists for odd and even and at last connected them but code is not working
Debug this code
Your Mistake
your add to linked list function is incorrect
i corrected it check
Logic :
- go to end of list
- now add the node of given data at end
Modified Code
but see this code is working.
this is because here you are inserting all node at once
using while loop
but in this case temp is garbage is head is not null means second time when you insert value
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.