Question: Shufe is a string problem that can be solved in recursion. Specically, let 51 and 52 be two strings. We can form a new shuffled

 Shufe is a string problem that can be solved in recursion.Specically, let 51 and 52 be two strings. We can form a

Shufe is a string problem that can be solved in recursion. Specically, let 51 and 52 be two strings. We can form a new shuffled string by interspersing the chars in 51 and s2 into a new string and preserving the order in which the chars appear in s1 and 52. For example, the strings spa and 5m can be shuffled into many new strings including the following... spa 5 m which results in the string sspma. Here*s another possible valid shuffle of these strings... spa sm which results in the string spasm. (Interestingly, we could NOT have made the string spasm had we started by using the rst 5 in 5m because then we would have had to use the first s in spa before using the p in spa.) The shuffle{string 51, string 52, string s3) returns true if 51 and s2 can be shufed to make s3 and returns false otherwise. You may assume that none of the initial strings 51, 52, and 53 is an empty string. E#include #include #include using namespace std; // Checks to see if the action is true or false. Ebool shuffle(string S1 = "spa", string $2 = "sm", string $3 = "In) { if ($1 == "spa") { 53 = 51; return true; else 53 = 52; return false; // The main function is used to print the values if true from the shuffle function. Flint main(string $3, string $1) { if (shuffle() == true) { cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!