What is a stack?

Asked 27-Dec-2017
Viewed 591 times

1 Answer


0

Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO i.e. Last In First Out or FILO i.e. First In Last Out. There are many real life examples of stack like the plates in a canteen. There are various operations that can be performed on stack for data retrieval and manipulation. These operations are : 

  • Push : Inserts data
  • Peek : Shows the last inserted data in stack
  • Pop : Removes the last inserted data in stack

What is a stack?