Flooding If the spot on the drawing is not empty return Color - - PowerPoint PPT Presentation

flooding
SMART_READER_LITE
LIVE PREVIEW

Flooding If the spot on the drawing is not empty return Color - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Example

slide-3
SLIDE 3

Suppose spot is ( 6, 12 )

spot on drawing is not empty, so no flooding to perform

slide-4
SLIDE 4

Suppose spot is ( 7, 7 )

spot on drawing is empty, so there is flooding to perform

slide-5
SLIDE 5

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

slide-6
SLIDE 6

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

spot (7,7) c

slide-7
SLIDE 7

spot (7,7) c

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

slide-8
SLIDE 8

Paint spot

spot (7,7) c

slide-9
SLIDE 9

Create to-do list

spot (7,7) c to-do list

slide-10
SLIDE 10

Add spot to to-do list

spot (7,7) c to-do list

  • (7,7)
slide-11
SLIDE 11

Loop while to-do list is not empty

spot (7,7) c to-do list

  • (7,7)
slide-12
SLIDE 12

Loop while 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 spot (7,7) c to-do list

  • (7,7)
slide-13
SLIDE 13

Loop while 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 spot (7,7) c v (7,7) to-do list

slide-14
SLIDE 14

Loop while 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 spot (7,7) c v (7,7) to-do list

slide-15
SLIDE 15

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
slide-16
SLIDE 16

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
slide-17
SLIDE 17

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
  • (8,7)
slide-18
SLIDE 18

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
  • (8,7)
slide-19
SLIDE 19

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
  • (8,7)
  • (7,6)
slide-20
SLIDE 20

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
  • (8,7)
  • (7,6)
slide-21
SLIDE 21

Loop while 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 spot (7,7) c v (7,7) to-do list

  • (6,7)
  • (8,7)
  • (7,6)
  • (7,8)
slide-22
SLIDE 22

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
slide-23
SLIDE 23

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
slide-24
SLIDE 24

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
slide-25
SLIDE 25

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
slide-26
SLIDE 26

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
  • (6,6)
slide-27
SLIDE 27

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
  • (6,6)
slide-28
SLIDE 28

Loop while 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 spot (7,7) c v (6,7) to-do list

  • (8,7)
  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
slide-29
SLIDE 29

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
slide-30
SLIDE 30

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
slide-31
SLIDE 31

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
slide-32
SLIDE 32

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
slide-33
SLIDE 33

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
slide-34
SLIDE 34

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
slide-35
SLIDE 35

Loop while 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 spot (7,7) c v (8,7) to-do list

  • (7,6)
  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
slide-36
SLIDE 36

Loop while 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 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

slide-37
SLIDE 37

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
slide-38
SLIDE 38

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
slide-39
SLIDE 39

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
slide-40
SLIDE 40

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
slide-41
SLIDE 41

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-42
SLIDE 42

Loop while 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 spot (7,7) c v (7,6) to-do list

  • (7,8)
  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-43
SLIDE 43

Loop while 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 spot (7,7) c v (7,8) to-do list

  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-44
SLIDE 44

Loop while 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 spot (7,7) c v (7,8) to-do list

  • (6,6)
  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-45
SLIDE 45

Loop while 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 spot (7,7) c v (6,6) to-do list

  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-46
SLIDE 46

Loop while 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 spot (7,7) c v (6,6) to-do list

  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
slide-47
SLIDE 47

Loop while 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 spot (7,7) c v (6,6) to-do list

  • (6,8)
  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
  • (6,5)
slide-48
SLIDE 48

Loop while 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 spot (7,7) c v (6,8) to-do list

  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
  • (6,5)
slide-49
SLIDE 49

Loop while 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 spot (7,7) c v (6,8) to-do list

  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
  • (6,5)
slide-50
SLIDE 50

Loop while 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 spot (7,7) c v (6,8) to-do list

  • (9,7)
  • (8,6)
  • (8,8)
  • (7,5)
  • (6,5)
  • (5,8)
  • (6,9)
slide-51
SLIDE 51

Loop while 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 spot (7,7) c v (9,7) to-do list

  • (8,6)
  • (8,8)
  • (7,5)
  • (6,5)
  • (5,8)
  • (6,9)
slide-52
SLIDE 52

Loop while 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 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)
slide-53
SLIDE 53

Loop while 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 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)
slide-54
SLIDE 54

Loop while 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 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)
slide-55
SLIDE 55

Loop while 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 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)
slide-56
SLIDE 56

Loop while 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 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)
slide-57
SLIDE 57

Loop while 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 spot (7,7) c v (7,5) to-do list

  • (6,5)
  • (5,8)
  • (6,9)
  • (10,7)
  • (9,6)
  • (9,8)
  • (8,5)
slide-58
SLIDE 58

Loop while 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 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)
slide-59
SLIDE 59

Loop while 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 spot (7,7) c v (6,5) to-do list

  • (5,8)
  • (6,9)
  • (10,7)
  • (9,6)
  • (9,8)
  • (8,5)
  • (7,4)
slide-60
SLIDE 60

Loop while 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 spot (7,7) c v (6,5) to-do list

  • (5,8)
  • (6,9)
  • (10,7)
  • (9,6)
  • (9,8)
  • (8,5)
  • (7,4)
slide-61
SLIDE 61

Loop while 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 spot (7,7) c v (5,8) to-do list

  • (6,9)
  • (10,7)
  • (9,6)
  • (9,8)
  • (8,5)
  • (7,4)
slide-62
SLIDE 62

Loop while 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 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)
slide-63
SLIDE 63

Loop while 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 spot (7,7) c v (6,9) to-do list

  • (10,7)
  • (9,6)
  • (9,8)
  • (8,5)
  • (7,4)
  • (4,8)
  • (5,9)
slide-64
SLIDE 64

Loop while 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 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)
slide-65
SLIDE 65

Loop while 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 spot (7,7) c v (10,7) to-do list

  • (9,6)
  • (9,8)
  • (8,5)
  • (7,4)
  • (4,8)
  • (5,9)
  • (6,10)
slide-66
SLIDE 66

Loop while 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 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)