I need the answer of below questions please:
Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the string hrwa, what is returned by g(f(x),x)? Explain your answer and result
Use big-O notation to classify the traditional grade school algorithms for addition and multiplication. That is, if asked to add two numbers each having N digits, how many individual additions must be performed? If asked to multiply two N-digit numbers, how many individual multiplications are required?
Thanks,© BrainMass Inc. brainmass.com March 4, 2021, 9:30 pm ad1c9bdddf
Since the function f() returns the result of a string it is passed, f("hrwa") will be "awrh". Also, since the function g returns the concatenation of the two inputs, g("awrh","hrwa") will be "awrhhrwa". These two functions can be put together so ...
This solution is a two-part solution. The first part shows how two string functions operate and how they can be composed. This is shown with an example and explanation. The second part provides a detailed explanation of the algorithmic complexity of the addition and multiplication algorithms.