Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Which of following is true about the reverse _ string function used in solving the problem of reversing a string? string reverse _ substring (

Which of following is true about the reverse_string function used in solving the problem of reversing a string?
string reverse_substring(string str, int start, int end)
{
if (start >= end)
{
return str;
}
char ch = str[start];
str[start]= str[end];
str[end]= ch;
return reverse_substring(str, start +1, end -1);
}
string reverse_string(string str)
{
return reverse_substring(str,0, str.length()-1);
}
Question 5 options:
The reverse_string function is a recursive function.
The reverse_string function is an iterative function.
The reverse_string function uses reverse_substring as a helper function.
The reverse_substring function uses reverse_string as a helper function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

Students also viewed these Databases questions

Question

Is there a link between chronic stress and memory function?

Answered: 1 week ago

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago

Question

=+Which associations exist?

Answered: 1 week ago