As we can see from the text this image purports to be an exa

As we can see from the text, this image purports to be an example of recursion

As we can see from the text, this image purports to be an example of recursion. Justify this by (informally) describing an algorithm that would draw this image. Assume the algorithm would be implemented by a single method called draw Recursion that takes a parameter describing the region of the image that needs to be filled in. The answer must include a description of the base case, the work done in each call, and the recursive call (e.g. parameters).

Solution

Answer: See the algorithm below

-----------------------------------------

1. Algorithm drawRecursion(a)

2. //a is the area of the image to be filled-in

3. { //start of algorithm

4.   if ( area not valid) //base case

5.       return;

6.   draw image; //do required work to draw image here.

7. define ration; //ratio is the value by which area of image to be drawn will be normalized.

8. drawRecursion(size/ratio); //recursive call

9. } //end of algorithm

As we can see from the text, this image purports to be an example of recursion As we can see from the text, this image purports to be an example of recursion. J

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site