CPSC 203, 2025 W1
October 23, 2025

How much work is done? Let \(n\) denote the size of the image, \(n = width \cdot height\)
Read image:
Choose centers:
Build new image:
Running time of original algorithm: ________
What would be better? ________
Orchestrate a fill from each center, growing out at the same rate.
Each pixel is processed exactly once, not once per center as before.
This means we can have lots of centers!
To implement the fill we use a datastructure called a QUEUE.
Queue:
enqueue(k) – places data k onto the structure, at the “end”dequeue() – removes and returns the “first” element from the structure

deque as our queue. What deque functions will we use?
deques have a way to check for empty?
(x,y)?
How much work is done? Let \(n\) denote the size of the image, \(n = width \cdot height\)
Read image:
Choose centers:
Build new image:


A Graph is a collection of vertices, and edges between them. They’re used as a general model for many problems.
In our images every ____________ is a vertex, and every ____________ is an edge.
Our fast algorithm for Voronoi Art mirrors a classic algorithm on graphs called Breadth First Search.
Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a ‘search key’), and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level. (–Wikipedia)
Simplified description: