Question: C++ not JAVA Write a recursive function string reverse(string str) that computes the reverse of a string. For example, reverse(flow) should return wolf. Hint: Reverse
C++ not JAVA
Write a recursive function
string reverse(string str)
that computes the reverse of a string. For example, reverse("flow") should return "wolf". Hint: Reverse the substring starting at the second character, then add the first character at the end. For example, to reverse "flow", first reverse "low" to "wol", then add the "f" at the end.
Write a recursive function bool is_palindrome(string str) that returns true if str is a palindrome, that is, a word that is the same when reversed. Examples of palindrome are "deed", "rotor", or "aibohphobia". Hint: A word is a palindrome if the first and last letters match and the remainder is also a palindrome
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
