Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An online computer system for trading stocks needs to process orders of the form buy 100 shares at $ x each or sell 100 shares

An online computer system for trading stocks needs to process orders of the form buy 100 shares at $x each or sell 100 shares at $y each. A buy order for $x can only be processed if there is an existing sell order with price $y such that y x. Likewise, a sell order for $y can only be processed if there is an existing buy order with price $x such that y x. If a buy or sell order is entered but cannot be processed, it must wait for a future order that allows it to be processed. Describe a scheme that allows buy and sell orders to be entered in O(log n) time, independent of whether or not they can be immediately processed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Explain Decentralization and Declassification

Answered: 1 week ago

Question

What is American Polity and Governance ?

Answered: 1 week ago