Question: 4) A doubly linked list is a data structure that can be traversed in both directions as given below. Below you are asked to write

 4) A doubly linked list is a data structure that canbe traversed in both directions as given below. Below you are asked

4) A doubly linked list is a data structure that can be traversed in both directions as given below. Below you are asked to write three functions related with a doubly linked list. In our implementation, only one global variable is declared for a doubly linked list which is to point to list's first element. struct DLLnode DLLfp int data; struct DLLnode *nextPtr; struct DLLnode *prevetr; xl 31 7 5 X } *DLLfp=NULL; c) Write a function int checkPalindrome ForDLL() that checks whether the contents of a doubly linked list form a palindrome. A palindrome is string, number or list which is the same when read or traversed from the reverse. An empty list is not a palindrome whereas a list with one element is a palindrome, as the first five lines demonstrate. The function returns 1 if the list is a palindrome, 0 otherwise. int checkPalindrome ForLL() { struct DL node *fp, *bp; if (DLLfp==NULL) return 0; else if (DLLfp->nextPtr==NULL) return 1; bp=DLLfp://backward pointer variable while bpbp->nextPtr; } fp-DLLip; //forward pointer variable while if (fp->data!-bp->data) return } return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!