The implementation of the flood-fill algorithm in Prog. 2.1 places all the neighboring pixels of each visited pixel into either thestackor thequeuewithout 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 thedepth-firstandbreadthfirstvariants given in Prog. 2.1 accordingly and compare the new runningtimes.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here