Flooding © 2018.

Slides:



Advertisements
Similar presentations
The “building blocks” of a composition.
Advertisements

Register Usage Keep as many values in registers as possible Register assignment Register allocation Popular techniques – Local vs. global – Graph coloring.
Emphasis The Focal Point of Fashion. Emphasis  A dominant focal point or center of interest in a garment or an outfit created by the use of line, shape,
Harmony. Refers to the use of lines, shapes, colors, textures and patterns with enough variety to avoid boredom, but not so much variety as to create.
 Small finger is 6, index finger is 7 middle finger 8, next 9 and up to thumb which is 10  Open palms facing you. Touch the fingers of two numbers you.
This is a painting from the 14th Century
▲ Using the Triangle Lighting Principle
Stacks CS-240 & CS-341 Dick Steflik. Stacks Last In, First Out operation - LIFO As items are added they are chronologically ordered, items are removed.
Dueling Algorithm. Data Structures List of potential candidates R = rightmost element of that list N = new element RN.
Positive and Negative Numbers
MOLARITY AND DENSITY. Header ChemistryName Experiment #17Date __ Mods__ Molarity and DensityPartner.
Space The elements of art.
3-D PAINTING WITH CYCLES AND RENDERING!!!. RENDERING Rendering is something you do to add color for exampke as,mr Batra explained me it can make 3-D Pictures.
Waterfront House Reflections. On the white paper, draw 2 horizontal lines. Below these lines, draw ripples for water.
Adding Free Text to the Chart. Activating the drawing tool bar Adding Free Text to the Chart, Slide 2Copyright © 2004, Jim Schwab, University of Texas.
Frequency Table 2-1. Vocabulary  Data – Information  Frequency Table – lists the number of times each item occurs in a data set.
How to Make Your Own Computer Drawing in Power Point Lewisville ISD Technology.
Multiplying and Dividing Decimals by 10, 100, and 1,000
Week 7. Lecture 2 Functions, Arrays, PHP&MySQL. Function with More than one argument and a return statement For a function to return a value, the return.
CSE 143 Lecture 10 Linked List Basics reading: slides created by Marty Stepp
By Mrs. T in Digital Art Class
Now, let’s examine the page data. We’ve already seen the page name and the directory where the page is saved.
 Create a new flash document. Press Ctrl+J key on the keyboard.
Graphing Exponential Growth and Decay. An exponential function has the form b is a positive number other than 1. If b is greater than 1 Is called an exponential.
Equations of Circles. You can write an equation of a circle in a coordinate plane, if you know: Its radius The coordinates of its center.
Our Cruise Holiday! Summer Day One Click the Insert Picture icon or Insert Media Clip icon above to add your holiday picture or video! Then, delete.
Yvonne Brown. When you add two numbers together you find how many you have in all. 5+3= = =00+1=10+2=20+3=30+4=40+5=5 1+0=11+1=21+2=31+3=41+4=51+5=6.
Stacks. What is a Stack? A stack is a type of data structure (a way of organizing and sorting data so that it can be used efficiently). To be specific,
GAME:IT Junior Paddle Ball Objectives: Review skills from Introduction Create a background Add simple object control (up and down) Add how to create a.
GAME:IT Paddle Ball Objectives: Review skills from Introduction Create a background Add simple object control (up and down) Add how to create a simple.
SYSTEM OF INEQUALITIES Graphing. Linear Inequalities and System of Linear Inequalities  Make sure both inequalities are solved for y.  Graph like an.
Elements and Principles Photo Scavenger Hunt
Flood fill algorithm Also called seed fill, is an algorithm that determines the area connected to a given node in a multi-dimensional array, When applied.
The Elements of Art and Principles of design
Introduction to Computational Thinking
Harmony.
Tape the essay checklist in the next page in your notebook
Our Cruise Vacation! Fall 2004.
Adding and subtracting decimals
Our Cruise Vacation! Summer 2002.
slides created by Marty Stepp
ASSIGNMENT NO.-2.
More Recursion.
Model Functions Input x 6 = Output Input x 3 = Output
Since H is 4 units to the left of the y-axis,
Value Value - The lightness or darkness of tones or colors. White is the lightest value; black is the darkest. Value Scale-A gray scale, a series of spaces.
Evaluate and Graph Polynomial Functions
Review 4 Lists and Sequences.
slides created by Marty Stepp and Ethan Apter
Harmony.
Additive and Subtractive Color
Assignment 1 Creating a Heart.
How to add questions to a WBI participant feedback questionnaire (1)
Adding and Subtracting Decimals
Adding a paddle (1) We now have a code, which will run forever and just have a ball bouncing around the screen until we shut down the program. To make.
Limits of Functions.
slides created by Marty Stepp and Hélène Martin
Compounds vs. Molecules
Review Mathematics Skills
1-4 Quartiles, Percentiles and Box Plots
Chapter 5 Stack (part 1).
Simplifying Circuits.
slides adapted from Marty Stepp
Space The element of art that refers to the emptiness or area around, between, above, below, or within objects. It defines shape and form.
Drawing Conclusions & Making Generalizations and Inferences
Sample Section from Mercator World Projection Map
Percentages Find 35% of 200 Find 5% of 80 Increase 120 by 15%
Ch. 3 Vocabulary 10.) Union 11.) Intersection 12.) Disjoint sets.
Managing Classrooms.
Presentation transcript:

Flooding © 2018

Flooding If the spot on the drawing is not empty return Color the spot using c Create a to-do list with spot as its element While the to-do list is not empty Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Example

Suppose spot is ( 6, 12 ) spot on drawing is not empty, so no flooding to perform

Suppose spot is ( 7, 7 ) spot on drawing is empty, so there is flooding to perform

Flood drawing starting at spot ( 7, 7 ) using c

Flood drawing starting at spot ( 7, 7 ) using c

Flood drawing starting at spot ( 7, 7 ) using c

Paint spot spot (7,7) c

Create to-do list spot (7,7) c to-do list

Add spot to to-do list spot (7,7) c to-do list (7,7)

Loop while to-do list is not empty spot (7,7) c to-do list (7,7)

Loop while to-do list is not empty spot (7,7) c to-do list (7,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) (8,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) (8,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) (8,7) (7,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) (8,7) (7,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,7) to-do list (6,7) (8,7) (7,6) (7,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) (6,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) (6,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,7) to-do list (8,7) (7,6) (7,8) (6,6) (6,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) (9,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) (9,7) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) (9,7) (8,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) (9,7) (8,6) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,7) to-do list (7,6) (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) y Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,6) to-do list (7,8) (6,6) (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,8) to-do list (6,6) (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,8) to-do list (6,6) (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,6) to-do list (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,6) to-do list (6,8) (9,7) (8,6) (8,8) (7,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,6) to-do list (6,8) (9,7) (8,6) (8,8) (7,5) (6,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,8) to-do list (9,7) (8,6) (8,8) (7,5) (6,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,8) to-do list (9,7) (8,6) (8,8) (7,5) (6,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,8) to-do list (9,7) (8,6) (8,8) (7,5) (6,5) (5,8) (6,9) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (9,7) to-do list (8,6) (8,8) (7,5) (6,5) (5,8) (6,9) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (9,7) to-do list (8,6) (8,8) (7,5) (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,6) to-do list (8,8) (7,5) (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,6) to-do list (8,8) (7,5) (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,8) to-do list (7,5) (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (8,8) to-do list (7,5) (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,5) to-do list (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (7,5) to-do list (6,5) (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) (7,4) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,5) to-do list (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) (7,4) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,5) to-do list (5,8) (6,9) (10,7) (9,6) (9,8) (8,5) (7,4) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (5,8) to-do list (6,9) (10,7) (9,6) (9,8) (8,5) (7,4) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (5,8) to-do list (6,9) (10,7) (9,6) (9,8) (8,5) (7,4) (4,8) (5,9) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,9) to-do list (10,7) (9,6) (9,8) (8,5) (7,4) (4,8) (5,9) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (6,9) to-do list (10,7) (9,6) (9,8) (8,5) (7,4) (4,8) (5,9) (6,10) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (10,7) to-do list (9,6) (9,8) (8,5) (7,4) (4,8) (5,9) (6,10) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list

Loop while to-do list is not empty spot (7,7) c v (10,7) to-do list (9,6) (9,8) (8,5) (7,4) (4,8) (5,9) (6,10) (11,7) (10,6) (10,8) Pop an element from the to-do list and assign it to v If v’s left is empty, paint it and add to to-do list If v’s right is empty, paint it and add to to-do list If v’s above is empty, paint it and add to to-do list If v’s below is empty, paint it and add to to-do list