From: Michal M. <mal...@pl...> - 2003-05-22 12:10:32
|
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 |