Name (print clearly): _________________________________________________
Student ID (print clearly; 1 digit per underline): _____ _____ _____ _____ _____ _____
CSE 231s Quiz 08: Flood Fill
class MutablePixels
Color getColor(int x, int y)
void setColor(int x, int y, Color color)
boolean isInBounds(int x, int y)
void floodFill(MutablePixels mutablePixels, Color nextColor, int x, int y)
Color prevColor = mutablePixels.getColor(x, y);
if (nextColor.equals(prevColor )) {
// pass
} else {
finish(() -> {
floodFillKernel(mutablePixels, prevColor, nextColor, x, y);
});
}
Write pseudocode for a parallel implementation of floodFillKernel below:
void floodFillKernel(MutablePixels mutablePixels, Color prevColor, Color nextColor, int x,
int y)