1. Trace, by hand, the execution of both variations ( depth-first and breadthfirst ) of the flood-fill algorithm using the image shown in Fig. 2.21 and starting at coordinates (5 , 1). 2. The...

1. Trace, by hand, the execution of both variations (depth-first
and
breadthfirst)



of the flood-fill algorithm using the image shown in Fig. 2.21 and starting at coordinates (5,
1).



2.
The implementation of the flood-fill algorithm in Prog. 2.1 places all the
neighboring pixels of each visited pixel into either the
stack
or the
queue
without ensuring they are foreground pixels and that they lie within the
image boundaries. The number of items in the stack or the queue can be
reduced by ignoring (not inserting) those neighboring pixels that do not


meet the two conditions given above. Modify the
depth-first
and
breadth first
variants given in Prog. 2.1 accordingly and compare the new running
times.







May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here