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 ownfoo
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