Question: I need a quick answer (java programming), please Activity 1 (Portfolio Task): Implement recursively the Sierpinski carpet. More specifically, a recursive function will take as

I need a quick answer (java programming), please

I need a quick answer (java programming), please Activity 1 (Portfolio Task):Implement recursively the Sierpinski carpet. More specifically, a recursive function will takeas input a 2D array of characters (i.e. char[]] board) of size3n3n, where 1 n5 (i.e. 33,99,2727,8181,243243 ). The 2D array can be

Activity 1 (Portfolio Task): Implement recursively the Sierpinski carpet. More specifically, a recursive function will take as input a 2D array of characters (i.e. char[]] board) of size 3n3n, where 1 n5 (i.e. 33,99,2727,8181,243243 ). The 2D array can be divided into 9 sub-arrays of size 3n13n1, e.g. a 33 array can be divided into 9 sub-arrays of size 1x1: We can now remove the middle sub-array (i.e. sub-array 5) resulting in the following array: For larger arrays this process is applied recursively, e.g. a 99 array: First, remove the middle 33 sub-array: Then, apply the process recursively on the 8 sub-arrays of size 33 (removing arrays of size 11 ): For an array of size 2727, the Sierpiski carpet would be as follows (remove 99 sub-array, then 33 sub-arrays, and then 11 sub-arrays): The array or characters is initialised by setting each cell to , while removing a subarray sets the corresponding cells to ' '. File 'Sierpinski_Carpet.zip' contains a Sierpiski carpet for sizes 33,99,2727,8181 and 243243 (in case sizes 8181 and 243243 are unreadable in your text editor, then you will need to reduce the font). Implement class SierpinskiCarpet, which: Stores a 2D array of characters (i.e. char[][] board) as well as the dimension size of the array (i.e. 3,9,27,81 or 243 ) Initializes the board with characters '*? Calls a recursive function that removes sub-arrays (by setting cells to ' ') resulting in a Sierpiski carpet (note that the recursive function must take the 2D array as input, but can take additional parameters that facilitate the recursion) Prints the Sierpiski carpet Discuss your progress with your Tutor during practical sessions. What to include in your Portfolio: Report: Describe in your report which parts of Activity 1 have been successfully implemented IntelliJ Project: Include your Java code for Activity 1 in your IntelliJ project under package "Practical_20

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!