I think z algo can be third party lib. But i try to optimize strings.Index 
with z algo. Later i can show benchmarks. Thanks for your help!

пятница, 17 сентября 2021 г. в 22:07:00 UTC+3, Ian Lance Taylor: 

> On Fri, Sep 17, 2021 at 12:03 PM vl4deee11 <vladboyc...@gmail.com> wrote:
> >
> > Yes, this algorithm is mainly used to quickly find a substring in a 
> string. O(n+m), where n=len(string), m=len(substring). I can run some tests 
> to check, and post them here. But I would also like to add the z algorithm 
> itself, this will be useful mainly for competitive programmers, and it will 
> become even more popular in competition.
>
> I don't understand what it means to add the z algorithm itself, but if
> you don't mean strings.Index then that does not seem like something
> that belongs in the Go standard library. See
> https://golang.org/doc/faq#x_in_std . It would be perfectly fine in
> third party library that people can import.
>
> Ian
>
>
> > пятница, 17 сентября 2021 г. в 19:54:51 UTC+1, Ian Lance Taylor:
> >>
> >> On Fri, Sep 17, 2021 at 8:38 AM vl4deee11 <vladboyc...@gmail.com> 
> wrote:
> >> >
> >> > Hello everyone, I need help, I often write algorithms on strings, and 
> often I need such a thing as a Z algo, is it possible to add it to a 
> 'std/strings' package ?
> >> > It can also be used in competitive programming, it is quite a useful 
> thing.
> >> >
> >> > More about Z algo - 
> https://www.geeksforgeeks.org/z-algorithm-linear-time-pattern-searching-algorithm/
> >>
> >> From a quick glance this looks like an efficient way of writing
> >> strings.Contains or strings.Index. If somebody wants to write a
> >> faster version of strings.Index, and can prove it using benchmarks, we
> >> would be happy to include that in the standard library. strings.Index
> >> is already pretty heavily optimized, but if we can make it faster we
> >> will.
> >>
> >> Ian
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to golang-nuts...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/40412bfb-ca84-4cf5-b094-710c10b00367n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/cde07eff-a03e-4722-ac63-4ec721b5aeefn%40googlegroups.com.

Reply via email to