I have a data structure which is as given below:
class File { public string Value { get; set; } public File[] Dependencies { get; set; } public bool Change { get; private set; }public File(string value,File[] dependencies) { Value = value; Dependencies = dependencies; Change = false; } }Basically, this data structure follows a typical build execution of files.
Each File has a value and a list of dependencies which is again of type File. Every file is exposed with a property called Change which tells whether the file is changed or not.
I brainstormed to form a algorithm which goes through all these files and build in an order( i.e typical build process ) but haven't got a better algorithm.
Can anyone throw some light on this?
Thanks a lot.
Mahesh
Follow these basic steps.
You’ll need some checks to detect circular dependencies which would cause and endless loop on step 5. Other than that, this should work.