CPSC 203, 2026 W1
October 27, 2026

Open last lecture’s activity. We’ll finish implementing the queue-based version of the algorithm.
voronoi_deque_nb.py.How far away are the diagonal pixels?
regular distance
four neighbours
eight neighbours
Size of the image: \(n\)
(\(n =\) width \(\times\) height)
Density of centers: \(d\)
Number of centers: \(dn\)
How does the execution time of these algorithms compare?
When comparing two algorithms, complexity analysis in computer science emphasizes the eventual winner as the problem size grows arbitrarily large.
Occasionally this approach proves wrong for practical problems.
Complexity analysis required that no pixel appear in the queue more than once.
False.False.True for that pixel.No longer easy to determine if the algorithm produces the correct result or even terminates. (See voronoi_deque_failures.py in Class Activity: Voronoi Art Fast.)
Proof of correctness is hard (and may be impossible)!
