Part II (30 points): Stacks 1. Suppose that the convention being used for a stac
ID: 3693927 • Letter: P
Question
Part II (30 points): Stacks 1. Suppose that the convention being used for a stack is that top should be the subscript of the top item, and that the stack will grow from high subscript to low subscript. Such a stack might look like the example shown to the right (where STACK-CAPACITY = 6): 0 2 3 4. 5 3.5 6.8 4.7 top Given the following partial class for such a stack: typdef float ElementType; class Stack( private: Blement Type myArray [STACK_CAPACITY] int top a) What value will top have when the stack is empty? b) What value will top have when the stack is full? c) How many items can this stack hold?Explanation / Answer
a) 4.7
b) 3.5 will be on top
c) stack can hold 6 items
d) since 3.5 is on top it must be removed
e) since 4.7 is below it will be removed last
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.