Hello.
Say I have a thousand instances of a structure, and some of these may be linked to each other due to some criteria that is used on action A.
Upon running action A for one of these structs, would it be better performance-wise to iterate through the thousand looking for (if any) are linked OR to possess a array in each struct that'd hold the pointers to its linked entities (if any), in a manner iterating through the thousand would not be necessary as it'd iterate through that array and then push the linked entities to perform the action.
Question is: Which is better? Iterating or aggregating the pointers to the linked entities?
Thank you for your time.