On Thu, May 22, 2003 at 06:51:04PM +0900, Nicolas Cannasse wrote:
> > > val find : string -> string -> int (* find a substring *)
> >
> > Using KMP or some other technique? (i.e. if it takes O(m * n), where m and
> > n are lengths of strings respectively? or O(log m * n + m))
>
> Right now only a naive O(m*n) technique. Please check the CVS, and submit me
> some code if you have a better implementation.
You can have a look at http://caml.inria.fr/Examples/oc/basics/kmp.ml
I tried rewrite of while loop to tail recursion, but it looks ugly.
--
: 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 ...
|
|
|
|