I have a python function defined as follows which i use to delete from list1 the items which are already in list2. I am using python 2.6.2 on windows XP
def comp
There are 2 issues that cause your algorithm to scale poorly:
x in list
is an O(n) operation.pop(n)
where n is in the middle of the array is an O(n) operation.Both situations cause it to scale poorly O(n^2) for large amounts of data. gnud's implementation would probably be the best solution since it solves both problems without changing the order of elements or removing potential duplicates.