python 2.7 set and list remove time complexity : <p>Wondering the time complexity of remove of list, and remove of set. </p>

<p>My thought and study result is,</p>

<ol>
<li>Removal of list is <code>O(n)</code></li>
<li>Removal of set is <code>O(1)</code>.</li>
</ol>

<p>I just studied some discussion, but never prove it. If anyone could shed some lights, it will be great. Especially how set implements with <code>O(1)</code> removal?</p>

<p>Using Python 2.7.</p>

<pre><code>a = set([1,2,3,4,5])
b = [1,2,3,4,5]

a.remove(3)
b.remove(3)

print a
print b
</code></pre>
