Maximize the bandwidth of the least wide link

Assignment Help Other Subject
Reference no: EM133028243

Routing

Part I. Widest PathRouting

N large files (1≤N≤105), numbered 1...N, are scattered on N distinct storages throughout a network that connects these storages. These storages are also numbered 1...N, such that file fi is at storage si. M links (1≤M≤105), numbered 1...M, where link i bidirectionally connects storage aiwith storage bi, and has a bandwidth wi(1≤ai,bi≤N,ai ≠ bi,1≤wi≤109). Bandwidthwitakes on integer values.

At any point in time, two files located at twostorages directly connected by a link may simultaneously swap places through the link. That is, the file on storage acan be transferred to storage b and the file on b can be transferred to a using the link that connects a and b. The files must perform such swaps until fiis at storage i for 1≤i≤N. That is, the files must eventually be placed at their "rightful" storage using the network.

To reduce the time to accomplish the task of moving files to their rightful storages, you are asked to design and implement an algorithm to maximize the bandwidth of the least wide link which the file transfer must use to move the files to their "rightful" storages speedily. It is guaranteed that it is possible for the files to move to their rightful storages.

INPUT FORMAT (file storage.txt):

The first line has two integers, N and M. The second line contains the N integers s1s2,..., sN. It is guaranteed that one storage contains one file.

Line i+2 contains the integers ai, bi, and wiwhere1≤i≤M.
OUTPUT FORMAT (file storageout.txt):
Outputone integer number: the maximum minimal bandwidth of a link which a file must use to move itself to its "rightful" storage. If the files are already in their "rightful" storages, then output -1.
SAMPLE INPUT 1:
4 4
3 2 1 4
1 2 9
1 3 7
2 3 10
2 4 3
SAMPLE OUTPUT 1:
9
In this example, one can move the files as follows to their rightful storages using links of bandwidth at least 9.

File 1 and file 2 swap locations using the 3rd link.
File 1 and file 3 swap locations using the 1stlink.
File 2 and file 3 swap locations using the 3rd link.

Output one integer number: the maximum minimal bandwidth of a link which a file must use to move itself to its "rightful" storage

SAMPLE INPUT2:
4 1
1 2 3 4
4 2 13
SAMPLE OUTPUT 2:
-1

Attachment:- Routing lab.rar

Reference no: EM133028243

Questions Cloud

Prepare general journal entry to record the reimbursement : On October 15, the petty cash fund was replenished and increased to $1,500. Prepare general journal entry to record the reimbursement
Justification for making the process less rigorous : Balancing principles and pragmatism in selection Matt is an HR adviser with a large engineering company. The company has a comprehensive selection policy that r
What is the net present value of the project : A project that has been tested for its feasibility has already incurred market research costs of £50,000. What is the Net Present Value of the project
Identify potential causes of the problem : The Fantasy Sports Trade Association ­estimates that approximately 57.4 million ­people in the United States and Canada play fantasy football.
Maximize the bandwidth of the least wide link : Design and implement an algorithm to maximize the bandwidth of the least wide link which the file transfer must use to move the files to their "rightful" storag
Organizational learning and training and development : How does this connection help us understand why the performance appraisal training program was not more successful?
What would be the firm new debt ratio : If Campbell were to purchase a new warehouse for $1.2 million and finance it entirely with long-term debt, what would be the firm's new debt ratio
Approaches human resource personnel : (a) Based on the above statement, discuss THREE (3) approaches human resource personnel used to evaluate employees' working performance.
How much of the loan is paid off during the first year : This extended problem covers many of the features of a mortgage. You purchase a town house for $200,000. How much of the loan is paid off during the first year

Reviews

Write a Review

Other Subject Questions & Answers

  Health care information systems are important in dispensing

health care information systems are important in dispensing of information throughout the organization. you will

  Examine underlying factors associated with illegal drug use

Examine the underlying factors associated with illegal drug use and prescription drug misuse among various demographics. Then, compare and contrast three.

  What exactly is cruel and unusual punishment

What exactly is cruel and unusual punishment under the Constitution

  How to empathize and adjusting your approach

Conflicting values and principles of different groups: what to look for, how to empathize, and adjusting your approach. Ethical dilemmas: what to expect.

  Which principle describe effect of an international airport

Which principle best describes the effect of an international airport on the value of a nearby residential subdivision?

  Basis of the information in the case study

The reasons for selecting the principal and secondary diagnoses - Social and cultural factors that may influence the principal and secondary diagnoses

  Identify the ethical dilemma presented

In the following scenario, place yourself in the role of a newly promoted first-line supervisor (sergeant) at a police department. You will write a memorandum.

  Describe the role that is associated with the status

List any active listening skills you used to resolve the conflict. If you didn't use active listening skills, then list the skill you could have used to resolve

  Dilution factor for conducting a bod5 test

In order for BOD results to be valid, it is desirable to maintain a minimum dissolved oxygen concentration at the end of the incubation period of at least 1.0 mg/L. If an industrial wastewater is known to have a COD of 1000 mg/L, recommend a dilut..

  What occupations did or do you plan to hold as an adult

When you were a child, what occupations did or do you plan to hold as an adult? What occupation or occupations did you end up holding/ what type of jobs did you or do you do?

  Explain seeing is not always believing

Explain one experience where you were deceived by what you saw. Explain one experience where you select not to think what you had seen.

  What are their results and conclusions of the study

What was the purpose of the study? Why did they do this study? How did they carry out this study? What are their results and conclusions? How has the reef changed over the 4 years they observed it and why is it changing?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd