what is wrong in this code
PAlindrome using linked list
Hello @Tiya,
There are following two problems in your code:
-
Your output format doesn’t match with that of the question.
-
There are few wrong assignments in your code.
I have modified your code. Please, refer to the comments:
Hope, this would help.
Give a like, if you are satisfied.
is the line no 82 rtemp=rtemp required
also wont we have to reverse the linked list after the mid ie rtemp=rtemp-.>next
Hey @Tiya,
-
You can eliminate that statement at line 82 as it is not causing any difference.
-
You have already reversed the second half of the linked list in the loop above line 82, with p being the last node of the original linked list and hence, the head of the reversed part of the linked list.
And as you have assigned that node to rtemp. So, they can be used interchangeably.
Hope, i have cleared your doubt.
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.