mardi 16 avril 2019

Is there any pattern/algorithm to know number of some property in dynamic tree?

I have a dynamic tree - nodes can be added/removed anytime. Every node:

  • can have N children;
  • has array of foo;
  • can add/remove foo to/from to his own foo array.

And I always need to know how many total foo in tree. Is there any pattern or algorithm for such problem, taking into consideration there is always only one thread (no multithreading)?

Aucun commentaire:

Enregistrer un commentaire