Question: Suppose you are designing a system for buying and selling stocks using a continuous limit order book strategy, as described in the beginning of this

Suppose you are designing a system for buying and selling stocks using a continuous limit order book strategy, as described in the beginning of this chapter. Describe how to use priority queues to process such buy and sell orders, including those that can be processed immediately and those that have some or all of their shares needing to wait until some future match to be processed. You don’t need to list all pending buy and sell orders, but you do need to always display the pending buy order(s) with the highest and lowest prices and the pending order(s) with the highest and lowest prices. You may assume that buy and sell orders are never cancelled and remain in the system until they are matched. Describe a system that can process buy and sell orders in amortized O(log n) time, where n is the number of orders in the system.

Step by Step Solution

3.41 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Place the order at the market Market orders are transactions meant to execute as quickly as possible at the current market price Place the order at the limit Limit orders set the maximum or minimum pr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

2036_61d6ac34259e4_835274.pdf

180 KBs PDF File

Word file Icon

2036_61d6ac34259e4_835274.docx

120 KBs Word File

Students Have Also Explored These Related Data Structures Algorithms Questions!