Re: [algogeeks] Re: Implement lastindexofastring(String s1,String s2)

2014-04-07 Thread Carl Barton
What I suggested is optimal and doesn't require you to reverse the strings. It's not hard to see that it takes O(n + m) which cannot be improved on. Additionally it works for any other search algorithm than KMP. On 7 April 2014 20:41, Dan wrote: > Depends on what language you are using??? > >

[algogeeks] Re: Implement lastindexofastring(String s1,String s2)

2014-04-07 Thread Dan
Depends on what language you are using??? Fortran has this capability built directly into it's standard Index() routine ( ie. it does what you might call a 'backwards' search). I imagine other languages have a similar capability. If not, and the strings are not huge memory hogs... or if y