Introduction -
Stack is an ordered collection of data items. It is a last in, first out (LIFO) abstract data type and linear data structure. In stack new items can be added and removed only at the top. Stack is similar to a pile of dishes where dishes can be added at the top and dish coming last would be removed first.
Remark - So, stack is a linear data structure where items are added or removed at one end only.
Figure - Stack
Operations on Stack -
There are basically two primitive operations that can be carried out on a stack -
Push - Push operation is used to add a new node to the top of the stack.
Figure - Push operation on Stack
No comments:
Post a Comment