subject
Business, 14.02.2020 22:25 nsaduadhq69831

In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue. A stack is a linear data structure which follows the last in, first out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue is another linear data structure that follows the first in, first out (FIFO) property. FIFO means that the data added first is the first to be removed (like a line in a grocery store-- the first person in line is the first to checkout).

Stack Behavior

Push – Add something to the top of the stack.

Pop – Remove something from the top of the stack and return it,

Example of LIFO operations-the data most recently added is the first to be removed

Queue Behavior

Enqueue – Add something to end of the queue.

Dequeue – Remove something from the front of the queue.

Example of FIFO operations-the newest data is last to be removed

Description

Your ABS and ABQ will be template classes, and thus will be able to hold any data type. (Many data structures follow this convention—reuse code whenever you can!) As with previous classes that use dynamic memory, you must be sure to define The Big Three: The Copy Constructor, the Assignment Operator, and the Destructor.

Data will be stored using a dynamically allocated array (hence the array-based stack and queue). You may use any other variables/function in your class to make implementation easier.

By default, your ABS and ABQ will have a scale factor 2.0f.

Attempting to push() or enqueue() an item onto an ABS/ABQ that is full will resize the current capacity to current_capacity*scale_factor.
When calling pop() or dequeue(), if the "percent full" (e. g. current size / max capacity) becomes strictly less than 1/scale_factor, resized the storage array to current_capacity/scale_factor.
Why increase (or decrease) the size by any amount other than one?

Short performance!

If you are increasing or decreasing the size of a container, it’s reasonable to assume that you will want to increase or decrease the size again at some point, requiring another round of allocate, copy, delete, etc.

Increasing the capacity by more than you might need (right now) or waiting to reduce the total capacity allows you to avoid costly dynamic allocations, which can improve performance—especially in situations in which this resizing happens frequently. This tradeoff to this approach is that it will use more memory, but this speed-versus-memory conflict is something that programmers have been dealing with for a long time.

An example of the resizing scheme to be implement on a stack.

ansver
Answers: 2

Another question on Business

question
Business, 22.06.2019 00:00
Pettijohn inc. the balance sheet and income statement shown below are for pettijohn inc. note that the firm has no amortization charges, it does not lease any assets, none of its debt must be retired during the next 5 years, and the notes payable will be rolled over. balance sheet (millions of $) assets 2016 cash and securities $ 1,554.0 accounts receivable 9,660.0 inventories 13,440.0 total current assets $24,654.0 net plant and equipment 17,346.0 total assets $42,000.0 liabilities and equity accounts payable $ 7,980.0 notes payable 5,880.0 accruals 4,620.0 total current liabilities $18,480.0 long-term bonds 10,920.0 total debt $29,400.0 common stock 3,360.0 retained earnings 9,240.0 total common equity $12,600.0 total liabilities and equity $42,000.0 income statement (millions of $) 2016 net sales $58,800.0 operating costs except depr'n $54,978.0 depreciation $ 1,029.0 earnings bef int and taxes (ebit) $ 2,793.0 less interest 1,050.0 earnings before taxes (ebt) $ 1,743.0 taxes $ 610.1 net income $ 1,133.0 other data: shares outstanding (millions) 175.00 common dividends $ 509.83 int rate on notes payable 1. what is the firm's current ratio? (points : 6) 0.97 1.08 1.20 1.33 2. what is the firm's quick ratio? (points : 6) 0.49 0.61 0.73 0.87 3. what is the firm's total assets turnover? (points : 6) 0.90 1.12 1.40 1.68 4. what is the firm's inventory turnover ratio? (points : 6) 4.38 4.59 4.82 5.06 5. what is the firm's debt ratio? (points : 6) 45.93% 51.03% 56.70% 70.00% 6. what is the firm's roa? (points : 6) 2.70% 2.97% 3.26% 3.59% 7. what is the firm's roe? (points : 6) 8.54% 8.99% 9.44% 9.91%
Answers: 2
question
Business, 22.06.2019 10:40
What would happen to the equilibrium price and quantity of lattés if the cost to produce steamed milk
Answers: 1
question
Business, 22.06.2019 13:10
A4-year project has an annual operating cash flow of $59,000. at the beginning of the project, $5,000 in net working capital was required, which will be recovered at the end of the project. the firm also spent $23,900 on equipment to start the project. this equipment will have a book value of $5,260 at the end of the project, but can be sold for $6,120. the tax rate is 35 percent. what is the year 4 cash flow?
Answers: 2
question
Business, 22.06.2019 15:20
Table 1. shows the expected demand for the dvd at different suggested donation levels, and they can act as a single-price monopolist if they choose to. thereceipts will be used to fund gstcg supplies for their data collection and conservation work. at the end of each sea turtle nesting season, any excess funds are donated by the gstcg to a local non-profit sea turtle research and rehabilitation facility. table 1 suggested anticipated total marginal profit donation per number of dvd revenue revenue dvd request requests $19.00 0 $15.00 2 $9.50 4 $7.75 10 $3.00 15 $0.00 20 a. complete table 1 by computing the total revenue, marginal revenue, and profit columns. b. the president wants the gstcg to provide videos to generate the most possible donations (total revenue). what price, if any, is the president of the gstcg favoring and how many people will receive the dvd if this becomes the price of the suggested donation? explain your answer. c. the education outreach committee wants the gstcg to provide videos to the highest possible number of people. what price, if any, is the educational outreach committee favoring and how many people will receive the dvd if this becomes the price of the suggested donation? explain your answer. d. the treasurer of the gstcg wants the dvd program to be as efficient as possible so that the marginal revenue equals marginal cost. what price, if any, is the treasurer favoring and how many people will receive the dvd if this becomes the price of the suggested donation? explain your answer. e. the fundraising committee wants the dvd program to generate as much profit in donations as possible. what price, if any, is the fundraising committee favoring and how many people will receive the dvd if this becomes the price of the suggested donation? explain your answer.
Answers: 3
You know the right answer?
In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue....
Questions
Questions on the website: 13722363