On Wed, 19 Aug 2009, Neal Becker wrote: > What would be a time efficient way to count the number of occurrences of > elements of sequence A in sequence B? (in this particular case, these > sequences are strings, if that matters).
If A and B are rather lengthy, then maybe build a tree from elements of A and use it to count elements of B. I.e., tree nodes would be counters. Building trees in Python, however, I guess it is a little bit tricky. Of course it is possible. But maybe you would rather have this tree maintained in C. Regards Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home ** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_r...@bigfoot.com ** -- http://mail.python.org/mailman/listinfo/python-list