in reply to Re: Better algorithm or data structure?
in thread Better algorithm or data structure?

I like your lateral thinking.

Unfortunately, I need to find all (any) sets completed by the state change of each boolean, at the time I receive that boolean. @someOrder was intended to represent the program receiving the notification of the booleans changing state over time, in some unspecifiable order.

That said, I think combining @sets into a hash keyed by the booleans is a very smart move. I think. I'm having trouble wrapping my head around how the sets, which will be referenced from multiple kash keys will get removed, but maybe tomorrow...


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.
RIP an inspiration; A true Folk's Guy
  • Comment on Re^2: Better algorithm or data structure?

Replies are listed 'Best First'.
Re^3: Better algorithm or data structure?
by johngg (Canon) on Aug 30, 2010 at 01:30 UTC

    How about making each "set" an object rather than just an anonymous array and store references to the objects in the %bools hash. You could then iterate over @someOrder in a loop rather than hash slicing and use the object destructor to take some action when the final reference to a "set" is deleteed from %bools.

    Just a thought that occurred to me while trying to get to sleep :-/

    Cheers,

    JohnGG