In: Computer Science
Stack ADT
What would you say is the most important drawback of using the stack that should be considered before choosing it for use in a real application? Typed out please.
Stack ADT:
The stack ADT is stack Abstract data type which is same as the implementation of stack with a small difference in the way it is implemented.
The stack follow the principle Last In First Out.
The element which is inserted at last in the stack is popped out first.
In the implementation of stack ADT, the pointer to the data is stored in each node, which means that to access the data,the pointer that is stored in the node can be used to access the data.
Drawback:
In the functionalities of the stack, there are only two basic operations that are allowed by a stack.
The stack is generally considered as a limited access data structure due to its limit of performing operations only on the top element of the stack.
The elements that are present below the top element are not accessible unless the top elements are popped out from stack.
consider the real time example of pushing the commands to be executed onto the stack.
Then, the command instruction that is given last by the user gets executed first while the old commands wait at the bottom of the stack.
consider a situation when we want to access the random element in a stack.We need to pop all the elements that are above the required element and then access it and push again all the popped elements back to stack.
These are the major issues and drawbacks that are associated with the stack
The better understanding of physical structure of the stack can be as shown below.