I am developing a code for a robot which is supposed to make a product. The process is composed of many tasks. each task may or may not depend on other tasks. I am wondering if there is a better approach than using trees or it's the perfect data structure for it.
2 Answers
I think you need a directed acyclic graph for your use-case.
To determine the order of execution of your tasks, you could use a topological sort on the DAG.