You are given two strings. Write an algorithm that creates a third string such that it contains both the given strings and it should be the smallest possible string. There is no condition regarding order of occurrence of given strings in the third string. Implement your algorithm in C++ using classes.

For Example:

a)S1=”hello”

S2 = “loot”

S3= “helloot”

S3 = “helloloot” //Incorrect as S3 is not the smallest possible string

b)S1= “hello”

S2 = “Delhi”

S3 = “helloDelhi” or “Delhihello”

a.Write the algorithm to concatenate two given strings.

b.Modify your algorithm so that it creates the third possible string.

c.Implement your algorithm in C++.

d.Make a comparison of above two algorithms on the basis of time and space complexity.

e.Can this problem be solved using iteration and recursion? Which one you will prefer and why?

For Example:

a)S1=”hello”

S2 = “loot”

S3= “helloot”

S3 = “helloloot” //Incorrect as S3 is not the smallest possible string

b)S1= “hello”

S2 = “Delhi”

S3 = “helloDelhi” or “Delhihello”

__Expectations:__a.Write the algorithm to concatenate two given strings.

b.Modify your algorithm so that it creates the third possible string.

c.Implement your algorithm in C++.

d.Make a comparison of above two algorithms on the basis of time and space complexity.

e.Can this problem be solved using iteration and recursion? Which one you will prefer and why?