In: Computer Science
A palindrome is a string of characters (a word, phrase, or sentence) that is the same regardless of whether you read it forward or backward – assuming that you ignore spaces, punctuation and case. For example, Race car is a palindrome. So is A man, a plan, a canal: Panama.
1. Describe how you could use a stack to test whether a string is a palindrome.
2. Describe how you could use a queue to test whether a string is a palindrome.
Algorithms for both the cases are given below:
1. Algorithm to check palindrome string using stack
2. Algorithm to check palindrome string using queue