fixed memory efficiency in greedy algorithm

it now analyses subsets in blocks of maximum size 10K each. This is
marginally slower (very marginal!) but enormously more memory efficient
than previous versions.