Gfg ide:-https://ide.geeksforgeeks.org/QVByxSyrHf
ques:- Check whether he linked list is palindrome or not
Link:-https://practice.geeksforgeeks.org/problems/check-if-linked-list-is-pallindrome/1
Gfg ide:-https://ide.geeksforgeeks.org/QVByxSyrHf
ques:- Check whether he linked list is palindrome or not
Link:-https://practice.geeksforgeeks.org/problems/check-if-linked-list-is-pallindrome/1
hello @manikjindal49
pls explain what u r trying here->
Node *next=slow->next,*curr=slow->next;
Node *check=slow,*check2=slow->next;
Node *prev=slow;
while(curr!=NULL){
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
Actually i am trying to reverse the second half of list and where i am using check is that so that the traversal canstop in next while loop
check now->
I understand all the things but I have one doubt AS why we are taking fast =head->next because if we want to find out the middle of the linked list we have to use fast =head not fast=head->next
both will give middle only.
in case of even length there are two middles. we want slow to stop on left middle thats why started head from head->next
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.