title: removing element from a list in python
body: <p>Is there any way of removing an element from a list in python in O(1) complexity.i.e.,
  remove(value):
             this searches linearly through the list and removes right.?
  So, is there any way to delete an element in O(1) complexity by specifying index or value?</p>
  
  <p>When input list of size 100000 is given to the following code,it is exceeding time limit..,even after using "del".</p>
  
  <pre><code>l=map(int,raw_input("").split(" "))
  n=l[0]
  k=l[1]
  s=map(int,raw_input("").split(" "))
  s=sorted(s)
  count=0
  tree=[]
  while len(s)&gt;0:
      poset=[]
      indices=[]
      i=0
      poset.append(s[i])
      indices.append(0)
      j=i+1
      while j&lt;len(s):
         if s[j]==k*s[i]:
             poset.append(s[j])
             indices.append(j)
             i=j
          j+=1
      tmp=0
      for i in indices:
          del s[i-tmp]
          tmp+=1                  
      tree.append(poset)
  
  for i in tree:
      if len(i)%2==0:
          count+=(len(i))/2
      else:
          count+=(len(i)+1)/2
  print count
  </code></pre>