[Tutor] efficient method to search between two lists

Terry Carroll carroll at tjc.com
Fri Mar 24 00:36:15 CET 2006


On Thu, 23 Mar 2006, Kent Johnson wrote:

> This is more efficient than the original algorithm because it reduces 
> the size of the loops to the number of matching elements rather than the 
> whole number of elements. But if there are a large number of matches it 
> will still be a lot of loops!

You're absolutely right.  I posted that right before bedtime as I 
surrendered to this cold I have.  I was just drifting off when I realized 
"well, that's no good: the real problem is still there."

I blame my cold medication.  That's my story, and I'm sticking to it.

Still, it was fun to code.  I'm just starting to get comfortable with list 
comprehensions, and this was a good learning exercise.




More information about the Tutor mailing list