On 11/1/07, Eugene McDonnell <[EMAIL PROTECTED]> wrote:
> Your mcs has the same number of tokens as my mis in "Maximum Infix
> Sums" in Vector 15.2, October 1998:
>
>      mis = ;[: >./ [: (0: >. +)/\. 0 ,~ ]
>     mis in
> 11
>
> There is a family resemblance.
>
> I credit the work I did as having derived from a K solution written by
> Arthur Whitney:
>
>      f : { | 0 (0 | +) \ x}

I used Arthur's example as a starting point as well. Unfortunately I
cannot get Vector 15.2 issue since it isn't available online, is it?
But I agree that our solutions looks very similar (the same algorithm
anyway) although mine appears to run 10 times faster (I modified your
definition to eliminate output of input sequence):

mis =. [: >./ [: (0: >. +)/\. 0 ,~ ]
mcs=:>./@:(-<./\)@:(0:,+/\)
in2=:5e3-?1e6$1e4
   mis in2
2599630
   mcs in2
2599630
   6!:2 'mis in2'
0.602303
   6!:2 'mcs in2'
0.056926

PS As a matter of fact, it is faster even in comparison with K's
version (though on older K 2.95 evaluation version interpreter):

f:|/0(0|+)\
in:(1000000 _draw 10000)-5000
f in
3156866
\t f in
453

But the actual question was: how to count MCS on a big memory mapped file...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to