String function evaluation and algorithm analysis
Not what you're looking for?
Hello,
I need the answer of below questions please:
1)
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
2)
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,
Purchase this Solution
Solution Summary
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.
Solution Preview
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 ...
Purchase this Solution
Free BrainMass Quizzes
Basic Networking Questions
This quiz consists of some basic networking questions.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.