Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With using queues and stacks ( Chapter 4 and 5 ) , update the following program to show an input string is a palindrome string

With using queues and stacks (Chapter 4 and 5), update the following program to show an input string is a palindrome string (Chapter 6).
A palindrome is a string that reads the same from both ends.
Lab Exam.pdf
Examples:
Input: str = "geeksforgeeks"
Output: No
Input: str =madam"
Output: Yes
A sample instruction:
Enter a string str
Create a stack object and a queue object
In a loop, letter by letter of the string str push them in the stack S and enqueue them in the queue Q :
Output: No
Input: str =madam"
Output: Yes
A sample instruction:
Enter a string str
Create a stack object and a queue object
In a loop, letter by letter of the string str push them in the stack S and enqueue them in the queue Q :
Add in the main program the code of //Push characters onto the stack and enqueue them in the queue
4. In another loop, compare the letters poping from the stack and dequeuing from the queue, if they are not the same, break or stop the loop and print that the entered string is not a palindrome. If all the letters poping from the stack and dequeuing from the queue are the same, your code should print the entered string is a palindrome.
Add in the main program the code of // Pop from the stack and dequeue from the queue, comparing characters
****
i want it in java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Factory Active Database For Enterprise Computing

Authors: Schur, Stephen

1st Edition

0471558443, 9780471558446

More Books

Students also viewed these Databases questions

Question

Presentation Aids Practicing Your Speech?

Answered: 1 week ago