Imagine that you are managing a supercomputer that runs jobs for your clients. A client
can submit a set of computing jobs, numbered from 1 to n, and the dependencies
among them. The dependencies are expressed as pairs. For example, (1, 2) means job 2
depends on job 1, i.e. job 2 can only start after job 1 finishes.
a) Write a program that determines if it is possible to finish all the jobs without
actually running them. Below are some example inputs and their expected
outputs.
Input: number of jobs = 2, dependencies = [(1, 2)]
Output: true
Explanation: We can run job 1 first followed by job 2.
Input: number of jobs = 2, dependencies = [(1, 2), (2, 1)]
Output: false
Explanation: We need job 1 to finish before we can run job 2, and job 2 to finish
before we can run job 1. This is clearly impossible.
Implement your algorithm in the method canFinish in job.cpp.
b) Write a program that checks if a given job j can be run
The post Write a program that determines if it is possible to finish appeared first on Assignment Freelancers.