Question: Q5) Recursion: (a) Write a recursive JAVA method to implement the paint fill function that one might see on many image editing programs. That is,

Q5) Recursion:

(a) Write a recursive JAVA method to implement the paint fill function that one might see on many image editing programs. That is, given a screen (represented by a 2-dimensional array of Colors), a point(x,y), and a new color, fill in the surrounding area until you fill all the screen.

Note that the screen 2-dimensional array has length L and width W which are predefined constants.

Assume that Color object is predefined:

void PaintFill(Color[][] screen, int x, int y, Color newColor){

(b) Is the implemented method in part a :

a. tail-recursive

b. non-tail recursive

c. Excessively recursive

d. Non-excessively recursive

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!