Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Augmenting and reducing data structures

by bliako (Monsignor)
on Apr 22, 2021 at 13:00 UTC ( [id://11131590]=note: print w/replies, xml ) Need Help??


in reply to Augmenting and reducing data structures

And if you want to take advantage of existing algorithms you could try convert your hash to N-ary Tree or cyclic Graph if you have loops and see if there are already existing algorithms to search for specific chains/branches. It will be challenging how you map an array and a hash to a branch of a tree, given they are ordered and un-ordered data. Perhaps sorting the hashes first. (just thinking out loud)

Edit: I took "augment" to mean "add/incorporate" (which it does) but it seems you want to modify, unless you want both (but this is not obvious from your test case). So the above is probably irrelevant.

bw, bliako

  • Comment on Re: Augmenting and reducing data structures

Replies are listed 'Best First'.
Re^2: Augmenting and reducing data structures
by Fletch (Bishop) on Apr 23, 2021 at 16:53 UTC

    For some reason this comment reminded me of zippers in functional languages. I've forgotten the minimal amount I knew of them but it vaguely tickled some recollection.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

        Lenses and zippers and monads are some of those really neat concepts when you're looking at Haskell or ML, but then you're like "This is cool, but I just need to do X with my tree." and then you're right back to XKCD 224 . . .

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found