This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ; x >= 0 ; --x)
loop, but we will do it recursively. Let’ try
to decompose the problem. 1 - Writing an array of length “n” can be
decomposed into writing a single character
(that’ easy) and writing and array of length
“n-1” backwards, which is a problem of the
same kind as writing an array of length “n”,
but it’ “simpler”.
s 13 2 - If we keep reducing the length of the array
that we have to write backwards, we will
eventually end up with an array of size 1.
That is: a character, and writing a
character is “easy”. EVEN BETTER,
we can go to an array of size ZERO and
then we have to do NOTHING. 14 Still, nothing in this description results in
something written backward! We refine:
An array is written backward by FIRST
writing its last element, and then writin...
View Full Document