For each position of the string starting at the end working


Question: Consider the subsequent pseudocode for constructing the reverse of an input string:

For each position of the string starting at the end working backwards

Append the character at that position to the reverse of the string.

Which is the correct for loop header for this pseudocode?

1. for (int i = 0; i <= input.length() - 1; i++)

2. for (int i = input.length() - 1; i >= 0; i--)

3. for (int i = input.length(); i > 0; i--)

4. for (int i = input.length() - 1; i > 0; i--)

Answer this question and show each and every step. Solve these questions in details and provide examples to support your rationale.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: For each position of the string starting at the end working
Reference No:- TGS0949747

Expected delivery within 24 Hours