Your skill will accomplishwhat the force of many cannot PerlMonks

### Re^3: The sum of absolute differences in the counts of chars in two strings.

by Limbic~Region (Chancellor)
 on Nov 20, 2011 at 01:23 UTC ( #939019=note: print w/replies, xml ) Need Help??

BrowserUk,
I don't understand the example. Should that t => 0 and t => 1 be 1 not 2?

Update: I am not going to have a chance to play with any of my ideas so I will just share them here in case they are of any help. I was hoping that there would be a way to "cancel out terms" such that there was less work to do. The two ideas I had for that would be performing bitwise operations on the strings to find out which characters were in common and only counting the remaining ones. The second idea I had would be to process the string in chunks rather than characters. If I were trying to do a generic solution though - I would like go with Inline::C (array vs hash) incrementing values for the first string, decrementing values for the second string and summing the 256 indices for the result in the end.

Cheers - L~R

• Comment on Re^3: The sum of absolute differences in the counts of chars in two strings.

Replies are listed 'Best First'.
Re^4: The sum of absolute differences in the counts of chars in two strings.
by BrowserUk (Pope) on Nov 20, 2011 at 13:14 UTC
Should that t => 0 and t => 1 be 1 not 2?

Yes. Now corrected.

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".
In the absence of evidence, opinion is indistinguishable from prejudice.

Create A New User
Node Status?
node history
Node Type: note [id://939019]
help
Chatterbox?
 [jonathanu]: modulecmd

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-03-19 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (246 votes). Check out past polls.

Notices?