Re: [python-win32] Identify unique data from sequence array

2010-12-22 Thread otrov
 1. Start with the first element (call it L)
 2. Scan downwind for an matching element (call it R)
 3. Compare L+1 and R+1 until you find a mismatch -- that's the current
 largest match.
 4. Repeat from 2 to see if you can find a longer match.

Actually, step 4. Repeat from 2..., can be further optimized with searching 
for match between preceding element of R and element shifted by R positions 
relative to R, then couple of routine random checks for matches in between L 
and R and shifted values by R positions ;)

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Identify unique data from sequence array

2010-12-22 Thread Tim Roberts
otrov wrote:
 1. Start with the first element (call it L)
 2. Scan downwind for an matching element (call it R)
 3. Compare L+1 and R+1 until you find a mismatch -- that's the current
 largest match.
 4. Repeat from 2 to see if you can find a longer match.
 Actually, step 4. Repeat from 2..., can be further optimized with searching 
 for match between preceding element of R and element shifted by R positions 
 relative to R, then couple of routine random checks for matches in between L 
 and R and shifted values by R positions ;)

I actually did consider including a Bayesian search in my original post,
but decided it muddied the waters too much.  I was more or less trying
to give the original poster something to start thinking about.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Identify unique data from sequence array

2010-12-22 Thread Aahz
On Wed, Dec 22, 2010, Mike Diehn wrote:

 I'm a unix guy.  That's what we call a sort-uniq operation, after the
 pipeline we'd use: sort datafile | uniq  uniq-lines.txt.  So I google that
 with python and 

Side note: these days if you're using GNU utilities (i.e. you're on
Linux or CygWin), you can do sort -u.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

Think of it as evolution in action.  --Tony Rand
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32