Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic
 
PerlMonks  

Re^3: list of unique strings, also eliminating matching substrings

by BrowserUk (Pope)
on May 30, 2011 at 12:12 UTC ( #907309=note: print w/ replies, xml ) Need Help??


in reply to Re^2: list of unique strings, also eliminating matching substrings
in thread list of unique strings, also eliminating matching substrings

I used this generator to create a 10000 string file where the first 5000 string are just randomly generated and the other 5000 are random substring extracted from the first 5000. Thus, you'd expect at most 5000 unique strings with a very slight possibility of there being fewer:

#! perl -slw use strict; sub rndStr{ join'', @_[ map{ rand $#_ } 1 .. shift ] } our $N //= 10e3; my $halfN = $N >> 1; my @data; $#data = $N; $data[ $_ ] = rndStr( 200 +int( rand 200 ), 'A', 'C', 'G', 'T', 'N' ) for 0 .. $halfN; $data[ $_ + $halfN ] = substr( $data[ $_ ], 10, 10 + int( rand( length( $data[ $_ ] ) - 20 ) ) ) for 0 .. $halfN; print for @data; __END__ C:\test> 906020-gen -N=10e3 > 906020.10e3

When I run your code on this file it misses some dups:

C:\test>906020-robo 906020.10e3 5551 unique items 4450 rejected. 5 seconds.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^3: list of unique strings, also eliminating matching substrings
Select or Download Code
Re^4: list of unique strings, also eliminating matching substrings
by roboticus (Canon) on May 31, 2011 at 01:33 UTC

    BrowserUk:

    Thanks, I'll dig into it tomorrow and see if I can find out what's going wrong.

    Update: I've confirmed the error (20110531) but haven't isolated it yet.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://907309]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-04-19 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (475 votes), past polls