Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Do not use any loops. You must use recursion Do not use any auxiliary data structures like StringBuilder, StringBuffer, array, list, map, set, stack, queue,
Do not use any loops. You must use recursion
Do not use any auxiliary data structures like StringBuilder, StringBuffer, array, list, map, set, stack, queue, etc
You can use helper if you want.
s, the String methods include length, isEmpty, charAt, substring.
ASAP!
Recursion: Write a recursive method unscramble (String s) that unscrambles strings. It goes through the input string s alternating placing letters at the front and back of the return string. Some example outputs are shown below. unscramble ("byultftre") "butterfly" 489 unscramble("") unscramble ("tyin") "tiny" unscramble ("t") unscramble ("dsaetrau tsctur") "data structures" If we take a closer look at the first input byultftre. We see that in the output string butterfly", the 'b' is placed at the front of the result string, then the 'y' is placed at the end, then the 'u' is tacked onto the string at the front which becomes bu", then the 'l is tacked onto the string at the end which becomes "ly" and so on and so forthStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started