anonymous
  • anonymous
help on attachment
Computer Science
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
1 Attachment
anonymous
  • anonymous
question 2 (a)
anonymous
  • anonymous
I would go for the easy way; trim all spaces on the string, and compare first place of the string to the last, make sure they're equal. then second to last-1, third to last-2, ... until you get to length/2. Return true if you get to length/2. false if at any point they are different. Example: able was i ere i saw elba -trim- ablewasiereisawelba compare: a = a? yes compare b = b? yes compare l = l? yes etc.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Apparently, I can't read, it's recursive. but same thing applies. public boolean testPalindrome(String palindrome){ if(palindrome.length() <= 1) return true; if(palindrome.chatAt(0) == palindrome.charAt(palindrome.length()-1) return testPalindrome(palindrome.substring(1, palindrome.length-1); else return false; } Code in Java, but it should be easy to adapt. You should do the comparison, and send to the recursive function the String minus the first and last places, then go at it again. Test for length, return true if you've reached 1 or 0 (if length was odd or even numbered), and return false if at any point they differ.

Looking for something else?

Not the answer you are looking for? Search for more explanations.