Stack | A complete concept of stack

in technology •  8 months ago

A stack is defined as a list in which all insertion and deletion are made at only one end that is called as top of stack ( TOS ). Some of the major components of stacks are,

  • Push - Insertion
  • Pop - Deletion
  • Peep - Extract Information 
  • Update - Update information from a particular location


The most recently pushed element can be checked prior to performance a pop operation. A stack is based on the last in first out algorithm in which the insertion and deletion operations are performed at one end of a stack. Also, the information in a stack can only be removed in the opposite order in which it was added to the stack. The most accessible information in a stack is at the top of the stack and least accessible information is at the bottom of the stack.

For example, consider a stack of plates placed on the computer in a cafeteria. During the dinner time customer take plates from the top of the stack and waiter puts the washed plates on the top of the stack. The plates that is put most recently on the stack is the first one to be taken off. The plate at the bottom is the last one to be used.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:

Hi! If you are good at java and C++ why have you not been contributing on various platforms?