"Hugo Arts" <hugo.yo...@gmail.com> wrote
A binary search requires data to be sorted, but works in O(log n), so It will always be faster than a naive linear search like the in operator performs.
Being picky but 'in' could be faster if the item searched for happens to be very near the front of the list. "Always" is a strong word :-)
But in general terms you are, of course, quite right, a linear search is slower than a chop for sorted data.
Alan G _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor