You are given N services and dependency pairs (u -> v) meaning u must start before v.
-
Produce a valid startup order if one exists; otherwise detect and report a cycle.
-
Output the services by dependency layers (all in-degree-0 services first, then the next layer, etc.).
-
Given each service i has a startup time t[i] and there are K CPU cores, schedule startups to minimize total completion time while respecting dependencies; describe your algorithm, complexity, and practical heuristics for parallel execution.