Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

provides a method to test whether a string is a pal letters are skipped Chapter

ID: 3862600 • Letter: P

Question

provides a method to test whether a string is a pal letters are skipped Chapter 4 dr cho palindromes uckage art ch02. stacks i port ch04. queues blic class Palindrome public static boolean test (String candidate) Returns true if candidate is a palindrome false otherwise. char ch; current candidate character being process length of candidate string int length: char from Stack: current character popped from stack char from Queue current character dequeued from queue boolean sti Palindrome true if string might still be a palindrome stackInterface character stack holds non blank string characters Queue Interface character queue: also holds non blank string character ll initialize variables and structures length candidate length Stack new Array Bounded stack character (length) queue new Array Bounded Queue Character (length)

Explanation / Answer

delete all lines of code and complete it only with the following loop:

i=0

j= candidate.length()-1

flag=1

for(;i<(candidate.length()/2), i++)

{

if (candidate[i]!=candidate[j])

       flag=0;

      break;

j--

}

return flag