Vidyalelo
Data Structure · Q568

Miscellaneous on Data Structures

Programming · Data Structure · question 568

Q568

Consider the following recursive implementation used to reverse a string: void recursive_reverse_string(char *s, int left, int right) if(left < right) char tmp = s[left]; s[left] = s[right]; s[right] = tmp; _________; Which of the following lines should be inserted to complete the above code?

A.
recursive_reverse_string(s, left+1, right+1)
B.
recursive_reverse_string(s, left-1, right-1)
C.
recursive_reverse_string(s, left+1, right-1)
Answer
D.
recursive_reverse_string(s, left-1, right+1)

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board