Question: 1 . Why is it a bad programming practice for the Stack ADT clear method to simply set the topIndex to - 1 in an

1. Why is it a bad programming practice for the Stack ADT clear method to simply set the topIndex to -1 in an array-based implementation?
Answer:
2. In an array based implementation of a Stack ADT, explain why it is a bad idea to use the first location of the array to reference the top of a stack.
Answer:
3. When would amortizing the cost of doubling an array size over all the additions to the stack work not out to be negligible?
Answer:
4. In a vector based implementation of a Stack ADT, explain why it is not necessary to keep track of the index to the top entry of the stack.
Answer:
5. In each of the array-based, link-chain, and vector implementations of a Stack ADT, describe how ensuring there is enough room to add an entry to a stack is handled.
Answer:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!