Thursday, 8 August 2013

Python string 'in' operator implementation algorithm and time complexity

Python string 'in' operator implementation algorithm and time complexity

I am thinking of how the in operator implement, for instance
>>> s1 = 'abcdef'
>>> s2 = 'bcd'
>>> s2 in s1
True
In CPython, which algorithm is used to implement the string match, and
what is the time complexity? Is there any official document or wiki about
this?

No comments:

Post a Comment