Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c++ pls 3:35 4 Drive ,ill HW 1 CS 210 sections 1,2,3 Due Date February 7th1159 PM You have been given the template for
in c++ pls
3:35 4 Drive ,ill HW 1 CS 210 sections 1,2,3 Due Date February 7th1159 PM You have been given the template for the ArrayStack, an array based stack. Recall that multiplying by a constant to increase array size, the amortized add to an array based stack is O(1). Recall that adding a constant to increase array size, the amortized add to an array based stack is O(N). You have three tasks. 30 points: You must create ArrayStackConst.h which is the constant adding array based increase 30 points: You must create ArrayStackMult.h which is the constant multiplier array based increase I have included ArrayStackDumb.h, which is a simple array which cannot be resized and will fail after it is full. The ensure_capacity() method will resize the array as need be (for const, will add that many entries, for mult will multiply previous size by that factor). This growth factor is aptly named STACK_GROWTH_FACTOR, which is to be used as both the additive and multiplicative constant (you may change this in the CPP file). When you have successfully implemented the above header files, you can run the CPP file and it will prompt youlas- filonamo those timings will When you have successfully implemented the above header files, you can run the CPP file and it will prompt you for a filename, those timings will be saved off. For both the multiplicative and the additive case, show the "spikes" (the resizing of the array) and the average cost to push to the stack. There are a few parameters you can play with: The initial stack size and growth factor determine your starting array size and how the array will be enlarged. The pushes per test is simply if you wish to average several pushes, increase over 1 to get this behavior. That is to say if you set it equal to 50 pushes per test, the timing will return a value corresponding with 50 pushes. The total passes is the total number of pushes to push to the stack. 40 points: Using these 4 parameters graph (using whatever you wish - but I have saved the timings out to a text file so Python, excel, etc are fine) the average cost from 1 to N for both the additive and multiplicative stack. Also show that where the array is resized a longer push operation occurs. Create a word document detailing such, include the 4 constants above that you used for each plot Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started