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

  Your task in this assignment is to develop a graphical user

your task in this assignment is to develop a graphical user interface based java program that can communicate with a

  Java program editing

Prompt the user for the student's score and put that value into an object

  Develop a java program

Develop a Java program which, given the width, length and depth (in metres), of a swimming pool, determines and outputs.

  Morgellons disease is delusional

Why do some scientists say that Morgellons disease is delusional? When there have been fibers extracted from patients that cannot be identified? Isn't that physical proof that something is affecting these people physically?

  1 gqueuea queue is an ordered collection of items in which

1 gqueuea queue is an ordered collection of items in which the removal of items is restricted to the fifo rst in rst

  Write a program that reads in a text file and then computes

Write a program that reads in a text file and then computes and prints a table of letter frequencies. For example, if the file is the text of "A Tale of Two Cities", found in the file at data/tales.txt , the program will print

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Identify the 5 code elements

Identify the 5 code elements for a Password class. Things like: class, instance, and final variables, accessor and mutator method, public and private specifiers for methods and member variables.i need to provide detail and descriptions for each code ..

  Write a program that creates an enumeration representing

Sherri rolls a 3 and decides to continue. She then chooses to roll two more times (6, 1). Because she rolled a 1, Sherri's turn ends and she earns 0 points.

  Discuss factors that affect sorting in sediment

Discuss factors that affect sorting in sediment. How could one tell the latitude at which a sediment was originally deposited? Compare and contrast phosphate and manganese nodules.

  Write an object-oriented java program to manipulate data

I want a simple java solution matching all the specifications in the document. The java program has to be made using Eclipseversion 4.2.1.

  Part-1prepare a program that teaches arithmetic to a young

part-1prepare a program that teaches arithmetic to a young child. the program tests subtraction and addition. in level

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