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...


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
queuewithout 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
breadthfirstvariants given in Prog. 2.1 accordingly and compare the new runningtimes.





May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here