Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science Algorithms, Divide and Conquer. PROBLEM: Fractals are geometric patterns that can arise from recursively drawing the same figure. They arise surprisingly often in

Computer Science Algorithms, Divide and Conquer.

PROBLEM:

Fractals are geometric patterns that can arise from recursively drawing the same figure. They arise surprisingly often in nature. One example is the Barnsley fern that can be seen in the first image below. Another nice example can be found in the branches of a tree. Fractal patterns even appear inside our own body. The last image depicts a mold of the insides of our lungs.

It turns out fractal patterns are good for respiratory systems for both humans and plants due to the large surface area resulting from the fractal.

Draw the following simplified model of a tree fractal which uses the following rule: A line segment will have two smaller line segments appended to the top of it as in the following

image text in transcribed

image text in transcribed

(a) Image from Wikipedia (b) Image from Fractal Foundation (c) Image from Fractal Foundation b b d a The line segments (b,c),(6, d) are each 1/3 the length of (a,b), and are added perpendic- ularly with respect to the line segment (a,b). Note that in the next iteration, the rule would be applied to the line segment (b,c) and separately to the line segment (b,d). 1. Each point is given by two coordinates, for example a = (ar, ay). Give formulas for the points c, d given the points a and b. 38 Hint: Given a and b, the point c is obtained as b+ (1/3) M (6 - a) where M= = 6 :-) 2. Write a recursive algorithm to draw the tree curve on a screen with nx n pixels with initial points a = (n/2, 1) and b = (n/2, n/2). The bottom left point is (1,1). You algorithm may use the function DRAW-LINE(X,Y) which draws a line segment between points X and Y in constant time, no matter the length. 3. Analyze the running time of your algorithm. Write down the recursion tree, the depth of the tree, the cost per level, and analyze the total cost. 39 (a) Image from Wikipedia (b) Image from Fractal Foundation (c) Image from Fractal Foundation b b d a The line segments (b,c),(6, d) are each 1/3 the length of (a,b), and are added perpendic- ularly with respect to the line segment (a,b). Note that in the next iteration, the rule would be applied to the line segment (b,c) and separately to the line segment (b,d). 1. Each point is given by two coordinates, for example a = (ar, ay). Give formulas for the points c, d given the points a and b. 38 Hint: Given a and b, the point c is obtained as b+ (1/3) M (6 - a) where M= = 6 :-) 2. Write a recursive algorithm to draw the tree curve on a screen with nx n pixels with initial points a = (n/2, 1) and b = (n/2, n/2). The bottom left point is (1,1). You algorithm may use the function DRAW-LINE(X,Y) which draws a line segment between points X and Y in constant time, no matter the length. 3. Analyze the running time of your algorithm. Write down the recursion tree, the depth of the tree, the cost per level, and analyze the total cost. 39

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago