Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Algorithm inspiration required. (Further thoughts on rolling checksums)

by Eily (Monsignor)
on Jun 18, 2018 at 16:44 UTC ( [id://1216871]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Algorithm inspiration required. (Further thoughts on rolling checksums)
in thread Algorithm inspiration required.

But where is the ultimate limit to this idea?
I didn't find an answer at first, but for me you would want the anchor to be at most the repeating pattern (because a longer anchor will have the same ratio in the data). So you could keep as an anchor either the longest non repeating sequence so far, or as big a sequence as memory will allow.

Actually if your anchor isn't too uniform, rather than compute checksums at each successive position you could then use Boyer Moore to "jump" to the next occurence of the pattern.

If the candidate pattern is too small, let's say N values, just read N values at a time in a loop until you find something that's different from your candidate. That something is probably a good choice of anchor (or as you said /($pattern)*($something)/).

  • Comment on Re^4: Algorithm inspiration required. (Further thoughts on rolling checksums)

Replies are listed 'Best First'.
Re^5: Algorithm inspiration required. (Further thoughts on rolling checksums)
by BrowserUk (Patriarch) on Jun 18, 2018 at 21:19 UTC
    loop until you find something that's different from your candidate. That something is probably a good choice of anchor

    I think this notion is the key to a solution.

    I haven't wrapped my brain around it yet, but I have some ideas. Many thanks for your input. I come back when I have something workable.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". The enemy of (IT) success is complexity.
    In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2025-11-12 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (68 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.