Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   design problem (http://www.go4expert.com/forums/design-problem-t21253/)

nizzy 8Mar2010 20:02

design problem
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:
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?

virxen 9Mar2010 04:01

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 05:27.