title: time complexity of sorting a dictionary
body: <p>I was wondering what is the time complexity of sorting a dictionary by key and sorting a dictionary by value. </p>
  
  <p>for e.g : </p>
  
  <pre><code>for key in sorted(my_dict, key = my_dict.get):
    &lt;some-code&gt;
  </code></pre>
  
  <p>in the above line , what is the time complexity of <strong>sorted</strong> ? If it is assumed that quicksort is used, is it O(NlogN) on an average and O(N*N) in the worst case ? </p>
  
  <p>and is the time complexity of sorting by value and sorting by key are different ? Since , accessing the value by its key takes only O(1) time, both should be same ?</p>
  
  <p>Thanks.</p>