Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: knapsack problem solved by regex

by rubasov (Friar)
on Mar 14, 2010 at 17:12 UTC ( #828592=note: print w/ replies, xml ) Need Help??


in reply to Re: knapsack problem solved by regex
in thread knapsack problem solved by regex

It has to do with the string being anchored at the central '0'.
Thus, thanks to this anchoring at the '0' character, the regex engine does indeed backtrack through combinations of v's in descending order of their sum.
Exactly. That "middle anchoring" is one of the main tricks in this regex. I also had to go through your previous to last regex example to find the last while crafting this. :-)


Comment on Re^2: knapsack problem solved by regex

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-01-28 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (227 votes), past polls