Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Macroeconomics Expert

1. Acme company buys and sells oil futures over the Internet. Its trading system receives buy orders from customers that seek to buy from the company. Each order has a bidding price. Orders may be deleted by the customer at any point in time and new orders may also come in at any time.The trading desk would like you to implement a system that keeps track of the top 100 highest buy orders at any point in time.You decide to build a data structure that has two parts: Minheap M of the top 100 orders, and a maxheap H that stores the remaining orders. The contents of the minheap are then displayed to the trading desk, whenever demanded.You are allowed heap operations: (a) min(M): returns the minimum element of a minheap M,(b) max(H): returns the maximum element of maxheap H, (c) insert(G,x): insert the element x in heap G and (d) delete(G,i): delete the ith element G[i] from heap G.Write down pseudocode for how you would update the M and H, under the following situations.Also, write down the worst-case running time in terms of the number of orders n that are currently active. You can assume for simplicity that n 100.

(A) A new order with price $B arrives. (Hint: You will first have to decide if the price is a top 100 price or not. Based on that you have to perform the appropriate heap operations).

(B) The top 100 order M[i] is withdrawn by the customer

2. An array is almost k sorted if every element is no more than k positions away from where it would be if the array were actually sorted in an ascending order.

(A) Write down pseudo code for an algorithm that sorts the original array in place in time nk log(k).Your algorithm can use a function sort(A, l, r) that sorts the subarray A[l], . . . , A[r].

(B) Suppose you are allowed extra array of size k + 1 on the side. Modify heap sort using a minheap of size k + 1, to sort the given array in time n log(k). (Hint: Take the first k + 1 elements and make a min heap. Keep extracting the minimum element from this min heap and adding anew element from the original array.).

Macroeconomics, Economics

  • Category:- Macroeconomics
  • Reference No.:- M91967968
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Macroeconomics

Question 1what is the current state of the us government

Question: 1. What is the current state of the U.S. government budget? 2. How do fiscal policy decisions made by the government impact the budget balance? 3. How do fiscal policy decisions made by the government impact th ...

Economics assignment -topic evaluation of macroeconomic

Economics Assignment - Topic: Evaluation of Macroeconomic performance of Australia and New Zealand. Task Details: Complete a research-based analysis and evaluation of the relative macroeconomic performance of Australia a ...

Question prehistory no names or dates here the key

Question: Prehistory. No names or dates here. The key questions are how early human groups supported themselves; what kind of social, economic, and political institutions they developed to manage the resources of their e ...

Question one of the big differences between the national

Question: One of the big differences between the National Football League and Power Five conference college football is that professional athletes receive payment for their services while collegiate athletics is strictly ...

Assignment -part 1 -brief description of the company - name

Assignment - PART 1 - BRIEF DESCRIPTION OF THE COMPANY - Name of your company and ASX code Why did you chose this company What do you know about this company Number of shares purchased (show calculations) Total amount of ...

Question firm 1 must decide whether to enter an industry in

Question: Firm 1 must decide whether to enter an industry in which firm 2 is an incumbent. To enter this industry, firm 1 must choose to build either a plant with a small output capacity (S), or large output capacity (L) ...

1explain four types of unemployment2explain the advantages

1. Explain four types of unemployment 2. Explain the advantages and disadvantages of:(a) A flexible exchange rate regime (b) A fixed exchange rate regime 3. Suppose the Reserve Bank of Australia increases the interest ra ...

Question the discussion answers must be a minimum of 125

Question: The discussion answer(s) must be a minimum of 125 words of substance with any references cited in APA format. No copying and pasting of work previously done for someone else. Business Growth Strategy - Horizont ...

Topics - mergers amp acquisition capital structure stock

Topics - Mergers & Acquisition, Capital Structure, Stock Trading etc. Q1. Develop an extensive form game with imperfect information (in which one of the players can be two or more types) that models any stylized economic ...

Question - you are in your first semester at college and

Question - You are in your first semester at college and deciding to spend your income between textbooks and food. You have $360 for the month. Textbooks are priced at $20 and food is priced at $10. Your parents decide t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As