- Dynamic or linked list implementation
- Static or array implementation
Static implementation of Stack:
In Static implementation of Stack, the size of the stack should be predefined or declared, hence it is called static because of it's static size. In this implementation, we must know the number of data elements that are going to be inserted in the stack, or else:If there are more number of data elements than our defined size, then the data cannot be inserted into the stack, hence loss of data.
If there are less number of data elements than our defined size, then it will result to the wastage of memory space.
Hence, We can implement this way if the number of data to be inserted in the stack is well-defined and constant.
No comments:
Post a Comment