[Tutor] lists+sort

Joel Goldstick joel.goldstick at gmail.com
Mon Jan 4 19:17:20 EST 2016


On Mon, Jan 4, 2016 at 5:35 PM, Danny Yoo <dyoo at hashcollision.org> wrote:

> On Jan 4, 2016 11:00 AM, "Pooja Bhalode" <poojabhalode11 at gmail.com> wrote:
> >
> > Hi, I wanted to check if this program can be used to merge the lists
> > together and sort them. This seems to work, but i wanted to check if
> there
> > are drawbacks in writing it in this manner.
>
> You may be missing some important details or misunderstanding a crucial
> detail.
>
> For example, the term "merge" in this context usually had a very specific
> technical meaning.
>
> Are your two input lists already sorted?
>
> The use of the term "linear" in the function definition:
>
> > def linear_merge(list1, list2):
>
> has a particular meaning in terms of algorithmic complexity, and the first
> implementation does not satisfy it: it does not perform linearly due to the
> internal use of the sort().
>
> If you have questions, please feel free to ask.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>

You may also take a look at this link:
http://stackoverflow.com/questions/7237875/linear-merging-for-lists-in-python

It appears that the poster was going through Googles python tutorials

-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays


More information about the Tutor mailing list