If your lists are large, linear-search algorithms will be very slow. Your program and the one by
use linear searches. You can find points in a sorted list much faster with a binary search, which is O(log n). The
module provides a generic implementation. (The learning curve for that module looks a bit steep, however.)