STACK

Stack

What is stack?

Stack is an Linear data structure which are in commonly used to organize the data. it is named stack as it behaves like a real-world stack, for example- a disk of cards or a pile of plates,etc.
A real-world stack allows operations at one end only For example We can place and remove a card  or plate from the top the stack only  Likewise, Stack ADT(Abstract data type) allows all data operations at one end  only, we can only access the Top  element of a stack.

Some important points.

  •  It is a type of linear data structure.
  • It follows LIFO (Last in First out) property.
  •  it has only one pointer TOP that points the last and top most element of stack.
  • Insertion and Deletion in stack can only be done from TOP only.
  • Insertion in stack is also known as a PUSH operation.
  • Deletion from stack is also known as POP operation in stack.

Basic Operations

Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(last in first out).
Mainly the following three basics operations are performed in the stack.

  • PUSH:Adds an item in the stack. if the stack is full,then it is said to be an Overflow condition.
  • POP:Remove an item from stack. The items are popped in the reversed order in which they are pushed.If the stack is empty,then it is said to be an Underflow condition.
  • PEEK:Return top elements of stack.

Stack Implementation

  •  Stack implementation using Array.
  • Stack implementation using Link List.
A Stack can be implemented by using Array and Linked List.stack can either be a  fixed size one or it may have a sense of dynamic resizing Here, we are going to implement stack using arrays,which makes it a fixed size stack implementation.

Implementation using Array

 
 

FAQ

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard

Is it Layered ?

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.

How can i edit the masks ?

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical

What do i need to open the files ?

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration

Is the font free ?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. It has been the industry’s standard

How can i edit smart objects ?

Yes, in fact that a reader will be distracted by the readable content of a page when looking at its layout.

Leave a Reply

Your email address will not be published. Required fields are marked *