Stack
Introduction to the data type stack. The stack is an abstract data type of defined operations. In this lesson, we will learn about the stack and its applications. We will also do some programming exercises to help you understand the concept through practice.
We'll cover the following...
The stack is an abstract data type with the following operations:
All the above operations are completed in O(1) time.
We can think of the stack as a pile of elements. Elements can be added to the top of the pile. To extract any element, we have to remove the elements on top of it.
The stack is also known as the Last In First Out (LIFO) data structure meaning that the element inserted last is the one that comes out first.
LIFO data structure: The stack has 6 elements; 1 is the top;
Applications of the stack
The following are ...