Question: Write a function (as pseudo code) that gets a matrix of colors, and a starting point, and colors the white area connected to the starting

Write a function (as pseudo code) that gets a matrix of colors, and a starting point, and colors the white area connected to the starting pint with RED.

See examples below:

The green point on the left represents the starting point.

The red points are the area containing the starting point.

For the pseudo code you may use colors by writing, e.g., BLACK, WHITE, RED. For example:

If

A[i) == WHITE A[i]) = RED %3D

Use recursion.

A[i] == WHITE ADD] =RED

A[i] == WHITE ADD] =RED

Step by Step Solution

3.46 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem using recursion you can use a flood fill algorithm Heres a pseudo code to colo... View full answer

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

Document Format (2 attachments)

PDF file Icon

6095fdffb8fb0_26481.pdf

180 KBs PDF File

Word file Icon

6095fdffb8fb0_26481.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!