You are given a n x n grid. Each grid

You are given a n x n grid. Each grid intersection point can be located using row and column indices. Take a look at the color pattern for n = 5.
 
Your are provided with the following function to color a triangle specified by vertices paint (color, (i, j), (k, 1), Cm, n)) will paint the triangle made out of (i, j), (k, 1) and (m, n) vertices with the color, color.
Example: paint (red, (2, 2) (3, 2) (3, 3)) was used to color the above triangle in 5 x 5 grid.
(a) Write an algorithm, CoLORGRID(A), to paint n x n grid according to above color pattern. 
(b) Analyze the running time of the algorithm and justify your answer. Note: Do not write Java code. Pseudo code only!

 

Leave a Comment

Your email address will not be published. Required fields are marked *

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top