Algorithm analysis with advanced data

Assignment Help JAVA Programming
Reference no: EM13371039

Algorithm Analysis with Advanced Data Structures

Alchemy

-Mines of Oreland yield unlimited amounts of silver, but no gold. Unfortunately, rich noblemen from the neighboring kingdom of Eldorado are interested only in buying gold.

-The resourceful merchants of Oreland want to hire alchemists to change the silver into gold. However, the skills of alchemists are somewhat limited - they cannot transmute any metal into any other, so the process of changing silver into gold may have to go through a sequence of transmutations involving other metals.

-For each transmutation, alchemists charge a fee, which depends on the pairs of metals involved in the transmutation.

-Your task is to write a program to help the merchants devise a sequence of transmutations that would change silver into gold with the smallest possible total fee paid to the alchemists.

Details

-Your program should read input from System.in:

-in the first line of input: a number of transmutations alchemists know how to handle

-for each transmutation the alchemists know: the metals it involves and its cost, as a triple, each in a separate line of input:

MetalX MetalY CostXY where:

-MetalX is the atomic number of the input (substrate) metal
-MetalY is the atomic number of the output (product) metal
-CostXY is the fee alchemists charge for transmuting 1 pound of MetalX into 1 pound of MetalY
-Your task is to find the sequence of transmutations, starting with silver (Ag, atomic number 47) and ending with gold (Au, atomic number 79), that has the smallest sum of fees for transmuting 1 pound of Ag into 1 pound of Au
-Your program should just return on System.out one number: the smallest possible sum of fees (it should not return the actual sequence)
-There will always be at least one way to change silver into gold

-Correct output: 9

Example
-Input:
10
47 28 5
28 29 3
26 79 6
28 26 2
79 26 4
28 79 9
26 47 7
29 28 2
47 29 10
29 79 1

-The sequence behind this correct output is (but your program shouldn't print it): 47,28,29,79 (that is: silver, nickel, copper, gold) 

Reference no: EM13371039

Questions Cloud

Mark snodgrass chapman snodgrass is leader of the victorian : mark snodgrass chapman snodgrass is leader of the victorian chapter of the grim reapers motorcycle club an outlaw
Part-1write a procedural email to employees reminding them : part-1write a procedural email to employees reminding them of key components of a company policy on acceptable use of
Part-1task 1 the first task in this assignment tests your : part-1task 1 the first task in this assignment tests your knowledge of what is required to build a fully-functioning
Requirementsas a starting point download the valueline : requirementsas a starting point download the valueline research report for your company. this research report provides
Algorithm analysis with advanced data : algorithm analysis with advanced data structuresalchemy-mines of oreland yield unlimited amounts of silver but no gold.
Drama characterdeath of a salesman arthur miller pp : drama characterdeath of a salesman arthur miller pp. 1261-1331response to the following questions after reading the
What is an evidence planan evidence plan has two partsbulla : what is an evidence plan?an evidence plan has two partsbulla tool to help the assessor explain to the student how
1you are a bond investor and youre examining a callable : 1.you are a bond investor and youre examining a callable bond. it can be called in 5 years. it is a semiannual bond.
Mortgage loan analysis a resident in sugar land is planning : mortgage loan analysis a resident in sugar land is planning to buy a new house in march 2014. the sale price of the

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Java program that allows the user to enter a letter

Write a java program that allows the user to enter a letter (as a code) and a real number (as the radius of a circle). If the letter is 'A' your program must calculate the area of the circle. If the letter is 'C' your program must calculate the ci..

  Write a java application to ask number of assignments

Write a java application that accomplishes the following tasks with built in exception handling: ask the number of homework assignment students have submitted in a semester

  Personalize the time zone application of section 24.3

Personalize the time zone application of Section 24.3. Prompt the user to log in and specify a city to be stored in a profile. The next time the user logs in, the time of their favorite city is displayed automatically.

  Write a java program that draws a square abcd

Write a java program that draws a square ABCD. The points A and B are arbitrarily specified by the user by clicking the mouse button. The orientation of the points should be counter-clockwise

  Problem 1write a java class called problem1 implement the

problem 1write a java class called problem1. implement the following method in your classpublic static int

  Create a class account that represents a banking account.

Create a class Account that represents a banking account.

  Use inheritance to read, store, and print questions for test

use inheritance to read, store, and print questions for a test. First, write an abstract class

  Check wether two appointments overlap

in a scheduling program, we want to check wether two appointments overlap. For simplicity, appointments start at a full hour,

  Assignment 2 descriptionyou are a mighty warrior and armed

assignment 2 descriptionyou are a mighty warrior and armed with your trusty bow and 3 arrows you enter the caves in

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  This project is for designing and developing a college

this project is for designing and developing a college registration program. prepare a java program to register

  The class constructor should accept an array

Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores. If any test score in the array is negative or greater than 10..

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