Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago