Skip to content

A stack is a linear data structure which can be implemented either using an array or a linked list.

License

Notifications You must be signed in to change notification settings

bhargaviajaypatel/DS_Stacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

DS_Stacks

A stack is a linear data structure which can be implemented either using an array or a linked list. The elements in a stack are added and removed only from one end, which is called top. Hence, a stack is called a LIFO (Last In First Out) data structure as the element that was inserted last is the first one to be taken out.

  1. Push Operation :- The push operation is used to insert an element into the stack. Before, inserting the value, we must first check if TOP=MAX-1, because if this is the case then it means the stack is full and no more insertions can further be done. If an attempt is made to insert a value in a stack that is already full, an OVERFLOW message is printed.
  2. Pop Operation :- The pop operation is used to delete the topmost element from the stack. Before, deleting the value, we must first check if TOP=NULL, because if this is the case then it means the stack is empty so no more deletion can further be done. If an attempt is made to delete a value from a stack that is already empty, an UNDERFLOW message is printed.

About

A stack is a linear data structure which can be implemented either using an array or a linked list.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages