Reference no: EM13961
Assignment1
Question
Write a recursive function void reverse ( ) that reverse a sentence.
For example:
Sentence greeting = new Sentence("Hello!);
greeting. reverse( );
cout << greeting.get_text( ) << "\n";
print the string " !olleH". Implement a recursive solution by removing the first character, reversing a sentence consisting of the remaining text, and combining the two.
Write the code for this assignment.
Assignment 2
Using recursion, find the largest element in a vector of integer values.
int maximum (vector<int> values)
Hint: Find the largest element in the subset containing all but the last element. Then compare that maximum to the value of the last element.
Assignment 3
Discuss how recursion breaks up complex computational problems into simpler ones. Identify three problems that would be difficult to solve without the use of recursion. Justify your response in simple C++ syntax.
Assignment 4
Compare and contrast recursion with iterative programming problem solving approaches. Discuss a programming scenario where iteration should be used and a scenario where recursion is better used than iteration.