On 4/23/2010 7:05 AM Robert Berman said...
Hi,
Given a list, list1 having 100,000 non repeating, sorted integers , which of
the following methods is fastest to find an item fully understanding the item
may or may not be in the list: The binary search method which is the standard
search for such a small sample size, or the more python type statement is
<value> in list1?
What I am really trying to ascertain is how expensive or how efficient is 'is
<value> in list1'.
It's expensive enough that for a list this size I'd convert it to a dict
and use in on that. eg,
a = range(100000)
d = dict(zip(a,a))
55555 in d
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor