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.
S2 = “loot”
S3 = “helloloot” //Incorrect as S3 is not the smallest possible string
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?
Re: design problem
and the problem is?
where is your code you have written so far?
|All times are GMT +5.5. The time now is 16:21.|