Describe a recursive solution to determine whether a String object is a palindrome. You may assume that the string only contains lower case characters (i.e. no numbers, spaces, punctuation, etc). Hint: It may be easiest to describe your solution using pseudocode.
What will be an ideal response?
isPalindrome(String s)
if the length of the string is 1
return true
else if the length of the string is 2 and the two characters are the same
return true
else if the first and the last characters are the same
return isPalindrome(the string created by removing the first and last characters)
else
return false
You might also like to view...
Which traversal does not use a stack?
a. inorder b. level order c. postorder d. preorder e. all of these traversals uses a stack
A printer and monitor are the most common input devices used to interact with the on-screen elements
Indicate whether the statement is true or false
The image specification that allows both transparency and animation in a browser without a plug-in is ____________________.
Fill in the blank(s) with the appropriate word(s).
What is the default summary function for numerical data in a PivotTable?
a. None of the others. b. Count c. Min d. Max