title: What is the complexity of these Dictionary methods?
body: <p>Can anyone explain what is the complexity of the following <code>Dictionary</code> methods? </p>
  
  <pre><code>ContainsKey(key)
  Add(key,value);
  </code></pre>
  
  <p>I'm trying to figure out the complexity of a method I wrote:</p>
  
  <pre><code>public void DistinctWords(String s)
  {
      Dictionary&lt;string,string&gt; d = new Dictionary&lt;string,string&gt;();
      String[] splitted = s.split(" ");
      foreach ( String ss in splitted)
      { 
          if (!d.containskey(ss))
              d.add(ss,null);
      } 
  }
  </code></pre>
  
  <p>I assumed that the 2 dictionary methods are of log(n) complexity where <em>n</em> is the number of keys in the dictionary. Is this correct?</p>