min = (int.MAX_VALUE, int.MAX_VALUE)
max = (int.MIN_VALUE, int.MIN_VALUE)
for (point in set)
if (point.x < min.x)
min.x = point.x
else if (point.x > max.x)
max.x = point.x
//same for y…
Today’s exercise for the class: why is this pseudocode wrong? And why has (an implementation of this) been in my codebase for months?
(The example of a set containing a single point may be educational.)