On Wed, Jun 9, 2010 at 10:25 PM, Qijing Li <qjing...@gmail.com> wrote: > Thanks for your reply. > I'm trying to understand python language deeply and use it efficiently. > For example: How the operator "in" works on list? the running time is > be O(n)? if my list is sorted, what the running time would be? > >
Still O(n). Python doesn't know that your list is sorted, so nothing changes. And the check to make sure it is sorted would be O(n) anyway. -- http://mail.python.org/mailman/listinfo/python-list