123


test is scheduled on 25th, 7:30 - 9:00pm pacific time zone 1) STL (vector, map, set) what are ways to insert items to a map? Set - items added will be unique. 2) Recursive program to display a given shape. 1.string, 2. binary search inside, 3.find height 4. find nodes 3) Using stack and queue
Answered 2 days AfterMay 23, 2022

Answer To: 123

Pawan answered on May 26 2022
90 Votes
Question1
Write a recursive function that accepts a string object as its argument and prints the string
in reverse order. Demonstrate the function in a driver program.
#include
using namespace std;
void print_reverse(string input, int pos){
if (pos < input.length()){
print_reverse(input, pos+1);
cout << input[pos];
}
}
int main()
{
string mystring = "mystring";
cout << "string input is " << mystring << endl;
cout << "reverse is ";
print_reverse(mystring, 0);
cout << endl;
}
Question 2
Write a program that reads a line of text, changes each uppercase let- ter to lowercase, and places each letter both in a queue and onto a stack. The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward or backward).
#include
#include
#include
using namespace std;
queue readline(std::string input){
queue chars;
for(int i=0; i ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here