On Thu, May 22, 2003 at 01:19:21PM -0500, Brian Hurt wrote:
> On Thu, 22 May 2003, Remi Vanicat wrote:
>
> > well, in the original code, one have :
> >
> > let kmp p =
> > let next = init_next p
> > and m = String.length p in
> > function s ->
> >
> > So Partial application of the first argument already compute the next
> > table. and so you can call the computed function on several different
> > string.
>
> Check. I'd missed that. On the other hand, you compute the length of p
> twice- once in kmp and once in init_next. Which is what I was trying to
> eliminate. Maybe I was being stupid- how expensive is a String.length? I
> was assuming it was O(n), linear with the length of the string.
String.length is O(1) (with very small ,,1'' :-)
--
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|