Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Pattern Finding

by tachyon (Chancellor)
on Sep 24, 2001 at 21:12 UTC ( #114370=note: print w/ replies, xml ) Need Help??


in reply to Re: Pattern Finding
in thread Pattern Finding

Have you considered what your 'rules' imply:

3. There could be multiple answers.
4. A Pattern may show up only once.
5. A Pattern may contain single character only

Every single char is by definition a pattern. So to is every combination of substrings. There will be quite a few answers. The number will be given by:

l + (l-1) + (l-2) + ..... ( l - (l - 1) ) + ( l - l )
where l = length of the string.

This is (l+(l**2))/2 for each and every string under your rules. BTW my substring/dictionary and best match hack returns this:

Best Matches: 6 occurrences of hello 4 occurrences of hi 4 occurrences of world 3 occurrences of book 3 occurrences of oh 2 occurrences of low 2 occurrences of pen C:\>

Your rules are not specific enough to formulate an answer. How do you define what is part of a pattern. Is this "Igohellohellohellohi" a string that contains 3 'hello' or 4 'hi' or 6 'l'..... Perhaps concluding this was the real task?

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


Comment on Re: Re: Pattern Finding
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-12-28 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (179 votes), past polls