I have an excel like grid where values can be typed referencing other rows
To check for circular references when a new value is entered, i traverse the tree and create a list of values referenced thus far, if the current value is found in this list, i return an error thus avoiding a circular reference. This is infrequent enough where extreme performance is not an issue but...
Question - is there a better way ? I'm told it's not the most optimal but no answer was provided so on to the experts @ SO :)