Question: codes must be in c programming PD Adobe AC PDF Dosy Dosyaland 2. Assume there are a special task sonsisting of n crucial steps and

codes must be in c programming

codes must be in c programming PD Adobe AC PDF Dosy Dosyaland

PD Adobe AC PDF Dosy Dosyaland 2. Assume there are a special task sonsisting of n crucial steps and m workers such that each of them only knows how to deal with a subset of steps. The task switches hands from one worker to another. Devise a greedy algorithm that takes an integer n together with m subsets A1, ..., Am (each subset A; contains all the steps that the worker i can handle) as input, and outputs an optimal scheduling that minimizes the number of switches, as an array of n assignments together with an integer indicating the number of switches. All the inputs given to the algorithm are assumed to be legitimate, i.e. the users are assumed to provide only integers. Assumen = 5, m = 3, and A2 = {1,2,5), A2 = {1,3,5), A3 = {2,3,4). Possible schedulings will be as follows: X = [1,1,2,3,1] with 3 switches (from 1 to 2, from 2 to 3, from 3 to 1) X = [1,1,3,3,2] with 2 switches (from 1 to 3, from 3 to 2) X = [1,3,3,3,1] with 2 switches (from 1 to 3, from 3 to 1) 3. Given a weighted undirected graph G where all the weights are fixed as 1, devise an algorithm that outputs a minimum spanning tree of G. Since all the weights are just 1, the algorithm is assumed to take an nxn adjacency matrix as input. The running time of your algorithm should be better than the running time of Kruskal and Prim. Also, all the inputs given to the algorithm are assumed to be legitimate, i.e. the users are assumed to provide only nxn matrices that consist of only Os and 1s as inputs. PD Adobe AC PDF Dosy Dosyaland 2. Assume there are a special task sonsisting of n crucial steps and m workers such that each of them only knows how to deal with a subset of steps. The task switches hands from one worker to another. Devise a greedy algorithm that takes an integer n together with m subsets A1, ..., Am (each subset A; contains all the steps that the worker i can handle) as input, and outputs an optimal scheduling that minimizes the number of switches, as an array of n assignments together with an integer indicating the number of switches. All the inputs given to the algorithm are assumed to be legitimate, i.e. the users are assumed to provide only integers. Assumen = 5, m = 3, and A2 = {1,2,5), A2 = {1,3,5), A3 = {2,3,4). Possible schedulings will be as follows: X = [1,1,2,3,1] with 3 switches (from 1 to 2, from 2 to 3, from 3 to 1) X = [1,1,3,3,2] with 2 switches (from 1 to 3, from 3 to 2) X = [1,3,3,3,1] with 2 switches (from 1 to 3, from 3 to 1) 3. Given a weighted undirected graph G where all the weights are fixed as 1, devise an algorithm that outputs a minimum spanning tree of G. Since all the weights are just 1, the algorithm is assumed to take an nxn adjacency matrix as input. The running time of your algorithm should be better than the running time of Kruskal and Prim. Also, all the inputs given to the algorithm are assumed to be legitimate, i.e. the users are assumed to provide only nxn matrices that consist of only Os and 1s as inputs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!