stack of integer elements is implemented as an array. The index of the top element is kept in position 0 in the array, and the stack elements are stored in stack[1], …, stack[stack[0]]. 1. How does this implementation fare when assessed against the idea of an array as a homogeneous collection of data elements? 2. How would this implementation change the stack specification?
A stack of integer elements is implemented as an array. The index of the top
element is kept in position 0 in the array, and the stack elements are stored in stack[1], …,
stack[stack[0]].
1. How does this implementation fare when assessed against the idea of an array as a
homogeneous collection of data elements?
2. How would this implementation change the stack specification?
3. How would it change the implementation of the functions?
A stack of integer elements is implemented as an array. The index of the top
element is kept in position 0 in the array, and the stack elements are stored in stack[1], …,
stack[stack[0]].
1. How does this implementation fare when assessed against the idea of an array as a
homogeneous collection of data elements?
2. How would this implementation change the stack specification?
3. How would it change the implementation of the functions?
Trending now
This is a popular solution!
Step by step
Solved in 2 steps