def getUnallottedUsers(bids, totalShares): # Write your code here Please use Python 1. Initial Public Offering A company
Fantastic news! We've Found the answer you've been seeking!
Question:
def getUnallottedUsers(bids, totalShares):
# Write your code here
Please use Python
Transcribed Image Text:
1. Initial Public Offering A company registers an IPO on a website sellshares.com. All the shares on this website are available for bidding for a particular time frame called the bidding window. At the end of the bidding window an auction logic is used to decide how many of the available shares go to which bidder until all the shares that are available have been allotted, or all the bidders have received the shares they bid for, whichever comes earlier. The bids arrive from the users in the form of <user Id, number of shares, bidding price, timestamp> until the bidding window is closed. The auction logic assigns shares to the bidders as follows: 1. The bidder with the highest price gets the number of shares they bid for 2. If multiple bidders have bid at the same price, the bidders are assigned shares as follows: Each bidder in the same price group gets assigned one share each consecutively, with each bidder being arranged inside the group based on their timestamp. Once a bidder gets the number of shares they bid for, they will be removed from the above iterative process and the process which then continues until all bidders are removed or the shares get exhausted, whichever comes first. List the user Id's of all users who did not get even one share after the shares have been allocated. For example, s come in as bids = [[1, 5, 5, 0], [2, 7, 8, 1], [3, 7, 5, 1], [4, 10, 3, 3]]. here are totalShares = 18 to allocate. The highest price bid is for user Id 2 for 7 shares at a price of 8, so that user gets 7 shares leaving 11 to allocate to lower prices. Users with Id's 1 and 3 each bid 5 for 5 and 7 shares, with bidder 1 having the earlier timestamp. After 5 iterations, 10 shares have been allocated with 5 shares going to each of these two bidders. Bidder 1 has the full allotment, bidder 3 has 2 more shares to buy and there is 1 share left to allocate. It goes to bidder 3 and all shares have been allotted. Bidder 4 is the only bidder who gets no shares. Function Description Complete the function getUnallottedUsers in the editor below. The function must return a list of integers, each an Id for those bidders who receive no shares, sorted ascending. getUnallottedUsers has the following parameter(s): bids[bids[0],...bids[n-1]]: a 2D array of arrays of integers, Id, shares, price, timestamp named u, sc, bp, ts going forward totalShares: an integer, the total shares to allocate Constraints • 1 ≤n<104 1 ≤ u, sc, bp, ts, totalShares < 108 1. Initial Public Offering A company registers an IPO on a website sellshares.com. All the shares on this website are available for bidding for a particular time frame called the bidding window. At the end of the bidding window an auction logic is used to decide how many of the available shares go to which bidder until all the shares that are available have been allotted, or all the bidders have received the shares they bid for, whichever comes earlier. The bids arrive from the users in the form of <user Id, number of shares, bidding price, timestamp> until the bidding window is closed. The auction logic assigns shares to the bidders as follows: 1. The bidder with the highest price gets the number of shares they bid for 2. If multiple bidders have bid at the same price, the bidders are assigned shares as follows: Each bidder in the same price group gets assigned one share each consecutively, with each bidder being arranged inside the group based on their timestamp. Once a bidder gets the number of shares they bid for, they will be removed from the above iterative process and the process which then continues until all bidders are removed or the shares get exhausted, whichever comes first. List the user Id's of all users who did not get even one share after the shares have been allocated. For example, s come in as bids = [[1, 5, 5, 0], [2, 7, 8, 1], [3, 7, 5, 1], [4, 10, 3, 3]]. here are totalShares = 18 to allocate. The highest price bid is for user Id 2 for 7 shares at a price of 8, so that user gets 7 shares leaving 11 to allocate to lower prices. Users with Id's 1 and 3 each bid 5 for 5 and 7 shares, with bidder 1 having the earlier timestamp. After 5 iterations, 10 shares have been allocated with 5 shares going to each of these two bidders. Bidder 1 has the full allotment, bidder 3 has 2 more shares to buy and there is 1 share left to allocate. It goes to bidder 3 and all shares have been allotted. Bidder 4 is the only bidder who gets no shares. Function Description Complete the function getUnallottedUsers in the editor below. The function must return a list of integers, each an Id for those bidders who receive no shares, sorted ascending. getUnallottedUsers has the following parameter(s): bids[bids[0],...bids[n-1]]: a 2D array of arrays of integers, Id, shares, price, timestamp named u, sc, bp, ts going forward totalShares: an integer, the total shares to allocate Constraints • 1 ≤n<104 1 ≤ u, sc, bp, ts, totalShares < 108
Expert Answer:
Answer rating: 100% (QA)
Below is a screen shot of the python program to check indentation Comments are given on every line e... View the full answer
Related Book For
Foundations of Financial Management
ISBN: 978-1259024979
10th Canadian edition
Authors: Stanley Block, Geoffrey Hirt, Bartley Danielsen, Doug Short, Michael Perretta
Posted Date:
Students also viewed these programming questions
-
Python Code plz # Given Code class AD(dict): def __init__(self, *args, **kwargs): """This initializer simply passes all arguments to dict, so that we can create an AD with the same ease with which we...
-
Write a Python code for this question: In the given set-up, plot the E fields inside both dielectrics if a. No charge is present in the interface. b. Charge is present in the interface (p, is nonzero...
-
Write Python code to implement the City Council management system. The program should do the following: Deliverables for this assignment are: 1. For the management system allocated to you, develop...
-
4. Papo and Pepe are two barbers from a small barbershop. Theyhave their two court chairs plus two waiting chairs. The followingresults were found: P0 = 1/16 P1 = 4/16 P2 = 6/16 P3 = 4/16 a. What is...
-
Mickelson reports on a calendar year basis. On January 1, 2014, Mickelson Corporation enters into a three-year lease with annual payments of $30,000. The first payment will be due on December 31,...
-
You receive an anonymous tip that your controller is embezzling assets from your company. You begin your investigation by interviewing several employees in the accounting department, who report no...
-
Its not like what youve done has really hurt anyone. At most, the missing money might cost earnings-pershare, maybe a penny. Is that what caused you to write those checks in the name of your company?
-
Palisade Creek Co. is a merchandising business that uses the perpetual inventory system. The account balances for Palisade Creek Co. as of May 1, 2019 (unless otherwise indicated), are as follows:...
-
How would a data analyst evaluate a conference call to get a feel for the sentiment of management?
-
2 Assume Airport "Zidlohovice" estimated its cost function as follows: C(q) = 100,000,000+ 0.1-q. C(q) is the total cost in PLN; q is the amount of take-offs and landings. Your demand for the current...
-
Use the following information to answer the five questions in the quiz: The estimated total factory overhead cost and total machine hours for Department 40 for the current year are $250,000 and...
-
How many d electrons and how many unpaired electrons are present in complexes nitropentammine cobalt ( III ) chloride, nitritopentammine cobalt ( III ) chloride andchloropentamminecobalt ( III )...
-
A rubber ball of mass m = = 0.5kg hits the floor with speed v = 2m/s and bounces back. The ball stays in contact with the floor for t=5ms = 0.005s. The force exerted on the ball by the floor is given...
-
friction force the block started to move when the angle 8=20 degrees find 1- The normal force 2- The friction force- 3- Static friction coefficient m=200g 20
-
25. A ball is thrown upward with a speed of 38.0 m/s from the top of a building 240. meters tall; a. What will be the velocity of this ball at the highest point? * b. How long will it take for this...
-
Two bodies of equal masses, m kg, are joined by a light inextensible cord passing over a smooth light pulley. Find what fraction of the mass must be taken from one and added to the other so that each...
-
On March 1, Dunder Corp purchased 1,400 (or 13%) of the common shares of Mifflin Corp for $31 per share. Legal fees of $1,000 were incurred on the purchase. On December 1, Mifflin Corp declared and...
-
Determine the reactions in supports A and D and connections B and C. Sketch its shear and moment diagram and determine the magnitude ankoration of the maximum shear and moment for every member. 18 3...
-
On January 1, 2013, Charley Dow bought 1,000 shares of stock at $12 per share. On December 31, 2015, he sold the stock for $18 per share. What was his annual rate of return?
-
A national financial institution is currently offering $50,000 a year for life as a special promotion. Current inflation is percent a year, and the real rate of return is assumed to be 3 percent. One...
-
The Alonso Corporation has forecasted to sell the following units of copper cables, at prices indicated, under three different economic conditions. The probability of each outcome is shown below....
-
Read the Ideas in Action section about Melinda Gates. Respond to the following questions based on Gatess experiences and your own experiences: A. What are some of the negative consequences of trying...
-
For each of the following items, respond with one or two paragraphs. A. Discuss how you can establish and build credibility before, during, and after your presentations. B. Describe the importance of...
-
Think about a recent presentation you attended that you found effective. In three to five paragraphs, describe why it was effective. Include the following aspects in your analysis, referring to...
Study smarter with the SolutionInn App