getSubStrings for given String

i just want know that if we are using loop inside recursive function then what is the meaning of using concept of recursion.

Can we implement without using loop i have tried and get success by certain point but stuck while returning list. I have just printed subsequences in console. It would be great if you can guide how can i return with list of all subsequences.

@LPLC0174,
Let’s say the string is abcd.
Now the result of this will be a + subsequences(bcd).
Answer of bcd will be b + subsequences(cd).
Answer of cd will be c + subsequences(d).
Answer of subsequences(d) will be d + subsequences(""), this is where we hit our base case and return arraylist with “” (empty string).

We are using loop to add elements to the arraylist. We use recursion to break down the string from “abcd” to “d” and finally hit the base case. Recursion is used to divide the problem into smaller fractions. The for loop is only used for final computation. Sure you can try to solve this without using loops.

Please share your code https://ide.codingblocks.com/ as well

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.