The program first does some changes to some objects. But the changes cause the objects to require additional work. If the objects are just a few, it’s not a big problem. But when they are quite a lot, I don’t want the program to start searching for the objects that need work.
Instead I want the program to memorise the the objects that need additional work and the type of work. The idea is to make the program start working on the objects immediately, without searching for them fist and then analyse them.
It’s true that the additional work can be done along with the first changes, but that may cause problems.
I do have two ideas: use a string variable where all the needed data about the needed work is stored, or use an array. But I don’t know if there are even better algorithms.
So I’m asking for a suggestion about a better or a different algorithm that lets the program do this.
A. You can have a queue or array or list of “work to do” or tasks.
B. When you change an object add it to the queue with a description of the relevant task.
C. When you finish you first part of the algorithm, go over the queue and perform the tasks.
D. Go to sleep, cause it was really hard (-: