Page 1 of 1

You are a contractor working for company C. This company builds computer chips, and it needs to buy a lot of silicon, wh

Posted: Thu Jul 14, 2022 2:27 pm
by answerhappygod
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 1
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 1 (91.37 KiB) Viewed 31 times
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 2
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 2 (41.96 KiB) Viewed 31 times
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 3
You Are A Contractor Working For Company C This Company Builds Computer Chips And It Needs To Buy A Lot Of Silicon Wh 3 (46.32 KiB) Viewed 31 times
Link to Part1: https://www.answers.com/homework-help/que ... q100174837
You are a contractor working for company C. This company builds computer chips, and it needs to buy a lot of silicon, which is the main material used to fabricate these chips. Your work, as a contractor, is to buy the amount of silicon needed (in kg ) from other companies, and sell it to company C. However, and since the pandemic started, the price of silicon has been very volatile. So, your task is to determine the max commission you can get from selling (x)kg of silicon to company C considering that several companies are selling silicon it at a different price per kg. For example: given two lists S=[a,b,c,d], and P=[$20,$90,$50,$30] where S represents a list of companies (subcontractors) selling silicon, and P the list of prices per (k) kilograms of silicon offered from these companies, where k=(i+1), and i represents the index of every price in P. Your goal is to find the maximum profit for selling 3 kg of silicon to company C if it is guarantied that you'll get a commission of 20% from this profit From the data given in this problem we can infer that: - Subcontractor company a offers 1 kg of silicon at a price of $20 - Subcontractor company b offers 2 kg of silicon at a price of $90 - Subcontractor company c offers 3 kg of silicon at a price of $50 - Subcontractor company d offers 4 kg of silicon at a price of $30 So, using the above offers from all the subcontractors, you (the contractor) can compute the maximum profit of selling 3 kg of silicon to company C using the following logic:
1. You buy 3 kg of silicon from company "c" at a total price of $50 2. You buy 1 kg of silicon from company "a" and 2 kg of silicon from company "b" at a total price of $20+$90=$110 3. You buy 1 kg+1 kg+1 kg of silicon from company "a" at a total price of $20+$20+$20= $60 4. You buy 3 kg out of 4 kg of silicon from company "d" at a total price of 4kg3kg​($30)=$22.5 Therefore, from all the transactions, the one that provides the maximum profit is transaction (2) where you can buy 3 kg of silicon for $110. Once the silicon you got is sold to company C for the same price you bought it, and after 20% of commission is applied, you'll get a profit of $22 for this transaction
4. (4 points) Modify your algorithm from problem 1.b (Dynamic Programming). Let F be a list of unsorted integers representing the number of kilograms of silicon, and P be a list of integers representing their prices, where (F,P[j]) means that Fkg of silicon cost P[j] dollars when i=j. For example, given F=[1 kg,5 kg,4 kg,3 kg]; and P=[$24,$6,$4,$2] find the maximum profit of selling 10 kilograms of silicon. (a) (1.50 points) Compute your dynamic programming table, and the dynamic programming function for this modification of the algorithm (b) (1 point) Write your pseudocode (c) (1.50 points) Compute the Big O (worst case) time complexity, and explain whether or not this new modification of the algorithm is faster than the one from problem 3 , and why.