Question: Problem 1: A palindrome is a string of characters that reads the same from left to right as it does from right to left. Write

 Problem 1: A palindrome is a string of characters that reads

Problem 1: A palindrome is a string of characters that reads the same from left to right as it does from right to left. Write a function called checkPalindrome that takes a string s1 and evaluate if the string is a palindrome or not using only a stack and a queue data structures. You should make use of the built-in java implementation of the stack and queue data structure under java.util.Stack and java.util.Queue Example 1 Input: s1 = "radar" Output: true Example 2: Input : s1 "HitTheRoadJack" Output: false Function Template- import java.uti1.Stack; import java.uti1.LinkedList; import java.uti1.Queue; public class Lab4 public static void main (String[] args) String s1"radar"; boolean ans checkPalindrome(s1); System.out.println (ans); // Should be True public static boolean checkPalindrome (String s1)( Stack (); = new Linked List (); // Example of stack push // Example of stack pop S.push("") s.pop () // Example of queue enqeue // Example of queue dequeue // Check if stack or queue is empty q.add("r") q.poll() s.isEmpty), q.isEmpty) / INSERT YOUR CODE HERE

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!