Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . Read a phrase and determine whether it is a palindrome or not. Write a c + + program to do the following: a
Read a phrase and determine whether it is a palindrome or not. Write a cprogram to do the following:
a Read the phrase characterbycharacter and store each letters or digits use isalnum function into a linked list pointed by listOriginal
b Find the middle of the listOriginal
c Reverse the second half of the listOriginal insert each element after the middle element in front of new list listRev and delete the element from the listOriginal.
d Compare the new listOrginal with listRev to test the phrase for being a palindrome or not
Sample run:
Enter a phrase: Top Spot
Original list: TopSpotNULL
New original half of the original: TopNULL
The second half in reverse order, listRev: topSNULL
The phrase is a palindrome character by character they are the same with extra S at the end. No matching for S because the number of characters is odd
CONTINUEyn y
Enter a phrase: No on
Original list: NoonNULL
New originalhalf of the original: NoNULL
The second half in reverse order :noNULL
The phrase is a palindrome
CONTINUEyn n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started