in
たとえば、オペレーターがどのように実装するかを考えています
>>> s1 = 'abcdef'
>>> s2 = 'bcd'
>>> s2 in s1
True
CPython では、文字列の一致を実装するためにどのアルゴリズムが使用され、時間の計算量はどのくらいですか? これに関する公式文書やウィキはありますか?
It's a combination of Boyer-Moore and Horspool.
You can view the C code here:
Fast search/count implementation, based on a mix between Boyer-Moore and Horspool, with a few more bells and whistles on the top. For some more background, see: https://web.archive.org/web/20201107074620/http://effbot.org/zone/stringlib.htm.
From the link above:
When designing the new algorithm, I used the following constraints: