Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void palindromeCheck(){
- int c=countElement();
- node *list=h,*revlist;
- revlist=NULL;
- int i=1;
- while(list){
- if(i>=((c/2)+2)&&i<=c){
- node *tmp=(node*)malloc(sizeof(node));
- tmp->d=list->d;
- tmp->p=revlist;
- revlist=tmp;
- }
- list=list->p;
- i++;
- }
- list=h,i=0;
- int count=0;
- while(i!=(c/2)){
- if((list->d)==(revlist->d)){
- count++;
- }
- list=list->p;
- node *tmp=revlist;
- revlist=revlist->p;
- free(tmp);
- i++;
- }
- if(count==(c/2))
- printf("Palindrome Found\n");
- else
- printf("Not Found\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement