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

Other questions on the subject: Business

image
Business, 21.06.2019 16:00, maddigrace3
Five times the sum of a number and 27 is greater then or equal to six times the of that number and 26. what is the solution set to this proportion?
Answers: 1
image
Business, 22.06.2019 05:00, jason9394
Identify an organization with the low-total-cost value proposition and suggest at least two possible measures within each of the four balanced scorecard perspectives.
Answers: 3
image
Business, 22.06.2019 06:40, anatomyfl
At april 1, 2019, the food and drug administration is in the process of investigating allegations of false marketing claims by hulkly muscle supplements. the fda has not yet proposed a penalty assessment. hulkly’s fiscal year ends on december 31, 2018. the company’s financial statements are issued in april 2019. required: for each of the following scenarios, determine the appropriate way to report the situation. 1. management feels an assessment is reasonably possible, and if an assessment is made an unfavorable settlement of $13 million is reasonably possible. 2. management feels an assessment is reasonably possible, and if an assessment is made an unfavorable settlement of $13 million is probable. 3. management feels an assessment is probable, and if an assessment is made an unfavorable settlement of $13 million is reasonably possible. 4. management feels an assessment is probable, and if an assessment is made an unfavorable settlement of $13 million is probable.
Answers: 1
image
Business, 22.06.2019 08:20, Svetakotok
Onsider the following subscription behavior information from genie, a web site that provides tools for constructing a family tree (ancestor search). subscriptions cost $9.99 per month, but you are charged for the entire year at the time of purchase. there is a one-year minimum term when you sign up for the service. once purchased, subscriptions are set to renew automatically unless the subscriber cancels them. when a membership renews, it renews for a one-year term and again you are charged for the entire year. there are no variable costs associated with providing this service to an individual customer, but genie does engage in customer relationship activities that they believe will increase customer retention. these customer relationship activities cost genie about $10 per year per customer. based on a sample of 1000 customers that joined genie five years ago, near the time when the company was founded, they were able to determine how many of those customers remained subscribers in the second year, third year etc. based on this information, genie calculated the average annual retention rate to be 20%. genie uses an annual discount rate of 8%. a. last year, genie spent $10,000 placing advertisements on google. genie management believes that these advertisements were responsible for about 300 new subscribers. would you recommend to genie management that they purchase more google ads? b. suppose a newly-introduced loyalty program increases the number of customers that remained to 30%. does this new data change your answer to 9.a? c. do you have any hesitations or concerns about making recommendations to management based on your above estimate of customer lifetime value?
Answers: 2
You know the right answer?
In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue....

Questions in other subjects:

Konu
Mathematics, 10.11.2020 20:10
Konu
Business, 10.11.2020 20:10
Konu
English, 10.11.2020 20:10
Konu
Mathematics, 10.11.2020 20:10