AlexTape has asked for the wisdom of the Perl Monks concerning the following question:
Omniscient Monks,
i meditate about minimizing keys and values in an hash tree.
data looks like this
the result should look like this:
what would be your approach to do it efficient? i know that the simple way is to call the values by reference.. but thats not what i want!
kindly perlig
i meditate about minimizing keys and values in an hash tree.
data looks like this
basically i got an object containing two lists (e.g. key list and attribute list). now i need an algorithm which is able to reduce needed memory without loosing relations[a, b, c] => [1, 2, 3] [b, c] => [2, 3, 4, 5] [a, c, d] => [4, 5, 6, 7] [d] => [1, 2, 6]
the result should look like this:
the problem is that the keys are really short (e.g. A1, A2,...) but the values (1,2,3,..) are really big data strings..[a, b, c, d] => [1, 2] [a, b, c] => [3] [a, b, c, d] => [4, 5] [a, c, d] => [6, 7]
what would be your approach to do it efficient? i know that the simple way is to call the values by reference.. but thats not what i want!
kindly perlig
$perlig =~ s/pec/cep/g if 'errors expected';
|
---|
Back to
Seekers of Perl Wisdom