Question: Fractal.java import java.applet.Applet; import java.awt.*; // Provides Graphics, Image public class Fractal extends Applet { private Image display; private Graphics drawingArea; public void init( )

Fractal.java
import java.applet.Applet; import java.awt.*; // Provides Graphics, Image
public class Fractal extends Applet { private Image display; private Graphics drawingArea; public void init( ) { int height = getSize( ).height; int width = getSize( ).width; display = createImage(width, height); drawingArea = display.getGraphics( ); randomFractal(0, height/2, width, height/2, drawingArea); } public void paint(Graphics g) { g.drawImage(display, 0, 0, null); } public static void randomFractal( int leftX, int leftY, int rightX, int rightY, Graphics drawingArea ) { final int STOP = 4; // When length
}
1. Write a Java program that fills an array as described below, and answer the question at the end. Note that the algorithm is very similar to that of the fractal program in the textbook. a. In the main0 method, create an integer array of any size b. Create a static, recursive method that receives two indexes, representing left and right boundaries of a continuous section of the array, and a reference to the array. This method sets the middle element, between left and right indexes, equal to the value (right - left). It then recursively calls itself on the left halfand right halfof the section, until left and right are adjacent indexes (e.g. left-2 and right-3, etc.) c. From the main0 method, start the 1st call to the method in (b) using left 0 and right equal to the last index. Below are graphs showing the aray values for two different size arrays. Print the final array values and include the output in your report. Note: you do not need to provide a graph. N=21 20 15 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Array Index N 100 100 80 60 40 20 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 Array Index d. What is the big-O time complexity of this algorithm if N is the size of the array? Briefly explain your answer 1. Write a Java program that fills an array as described below, and answer the question at the end. Note that the algorithm is very similar to that of the fractal program in the textbook. a. In the main0 method, create an integer array of any size b. Create a static, recursive method that receives two indexes, representing left and right boundaries of a continuous section of the array, and a reference to the array. This method sets the middle element, between left and right indexes, equal to the value (right - left). It then recursively calls itself on the left halfand right halfof the section, until left and right are adjacent indexes (e.g. left-2 and right-3, etc.) c. From the main0 method, start the 1st call to the method in (b) using left 0 and right equal to the last index. Below are graphs showing the aray values for two different size arrays. Print the final array values and include the output in your report. Note: you do not need to provide a graph. N=21 20 15 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Array Index N 100 100 80 60 40 20 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 Array Index d. What is the big-O time complexity of this algorithm if N is the size of the array? Briefly explain your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
