4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Stack | A complete concept of stack

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.

2 upvotes $0.00

Replies (2)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: