title: String comparison in constant time
body: <p>I was thinking about faster way to compare two strings.
  Checking if value exists in Python set (hash table) has constant time.
  Does it means that looking for a string in a <strong>set</strong> has also constant time?</p>
  
  <pre><code>print('tya' == 'tya') #O(n)
  mySet = set()
  mySet.add('tya')
  if 'tya' in mySet: #O(1) &lt;-- ???
      print('True')
  </code></pre>
  
  <p>In more general case, does it mean that I can find sub-string in string in linear time???</p>
  
  <pre><code>def NaiveFind(largeString, subString):
      mySet = set()
      mySet.add(subString)
      index = -1
      start = 0
      end = len(subString)
  
      while(end &lt; len(largeString)): #O(n-m)
          windowFromLarge = largeString[start:end]
          if(windowFromLarge in mySet): #O(1) &lt;------- LINEAR ???
          #if(windowFromLarge == subString): #O(m)
              return start
          start += 1
          end += 1
  
      return index
  
  </code></pre>