TeX source:
O(n)