Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A-4.2 Suppose you are working for a fast-growing startup company, which we will call FastCo, and it is your job to write a software package

image text in transcribed

A-4.2 Suppose you are working for a fast-growing startup company, which we will call "FastCo," and it is your job to write a software package that can maintain the set, E, of all the employees working for FastCo. In particular, your software has to maintain, for each employee, x in E, the vital information about x, such as his or her name and address, as well as the number of shares of stock in FastCo that the CEO has promised to r. When an employee first joins FastCo they start out with 0 shares of stock. Every Friday afternoon, the CEO hosts a party for all the FastCo employees and kicks things off by promising every employee that they are getting y more shares of stock, where the value of y tends to be different every Friday. Describe how to implement this software so that it can simultaneously achieve the following goals es 153 The time to insert or remove an employee in E should be O(log n), where n is the number of employees in E . Your system must be able to list all the employees in E in alphabetical order in O(n) time, showing, for each r in E, the number of shares of FastCo the CEO has promised to r . Your software must be able to process each Friday promise from the CEO in O(1) time, to reflect the fact that everyone working for FastCo on that day is being promised y more shares of stock. (Your system needs to be this fast so that processing this update doesn't make you miss too much of the party.)

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

Step: 3

blur-text-image

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions