Andrei Alexandrescu wrote: > That's three sorts and at least one temporary array. If a temporary array is allowed, the ranks and the sum of the ranks might be computed by a diogonal sweep over the area defined by the two dimensions and populated by the elements. Population and sweep would each be linear in time. -manfred