Using a dictionary is another way.

On Thu, Mar 6, 2014 at 3:30 PM, Roger Hui <rogerhui.can...@gmail.com> wrote:

> Yes, that's the cost.  The trick is to avoid initializing count altogether,
> because for this subproblem M is much greater than n.  The answer is
> algorithmic and not a matter of using this or that C operation.
>
> Recently I had occasion to use the trick for M=65536 and n about 5000.  As
> originally posed, I think the intention was that M would be zillions.
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to