Binary search tree
bdesth.quelquechose at free.quelquepart.fr
Fri Nov 9 23:45:19 CET 2007
maxim.novak at gmail.com a écrit :
> I have to get list of URLs one by one and to find the URLs that I have
> more than one time(can't be more than twice).
> I thought to put them into binary search tree, this way they'll be
> sorted and I'll be able to check if the URL already exist.
What about a set ?
s = set()
for url in urls:
if url in s:
print "already have ", url
More information about the Python-list