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.