For function isReverse, write the two missing base case conditions. Given two strings, this function returns true if the two strings are identical, but are in reverse order. Otherwise it returns false. For example, if the inputs are "tac" and "cat, then the function should return true. Examples:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
CodeW
For fun X C Solved
https://codeworkou...
臺亂
CodeWorkout
X272: Recursion Programming Exercise: Is
Reverse
For function isReverse, write the two missing base case conditions. Given two strings, this
function returns true if the two strings are identical, but are in reverse order. Otherwise it
returns false. For example, if the inputs are "tac" and "cat", then the function should return true.
Examples:
isReverse("tac", "cat") -> true
Your Answer:
1 public boolean isReverse(String s1, String s2) {
2.
if <<Missing condition 1>>
3.
4.
else if <<Missing condition 2>>
return true;
return false;
5.
6.
else {
String s1first =
String s2last
return s1first.equals (s2last) &&
51. substring(0, 1);
s2, substring(s2.length() 1);
7.
8.
6.
isReverse(s1.substring(1), s2.substring(0, s2.length() 1));
{
12}
1:11AM
50°F Clear
12/4/2021
Transcribed Image Text:CodeW For fun X C Solved https://codeworkou... 臺亂 CodeWorkout X272: Recursion Programming Exercise: Is Reverse For function isReverse, write the two missing base case conditions. Given two strings, this function returns true if the two strings are identical, but are in reverse order. Otherwise it returns false. For example, if the inputs are "tac" and "cat", then the function should return true. Examples: isReverse("tac", "cat") -> true Your Answer: 1 public boolean isReverse(String s1, String s2) { 2. if <<Missing condition 1>> 3. 4. else if <<Missing condition 2>> return true; return false; 5. 6. else { String s1first = String s2last return s1first.equals (s2last) && 51. substring(0, 1); s2, substring(s2.length() 1); 7. 8. 6. isReverse(s1.substring(1), s2.substring(0, s2.length() 1)); { 12} 1:11AM 50°F Clear 12/4/2021
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning