Course Data Structures Essentials
Stack
Hello again ๐. In this class you will learn about Stack and its main functions.
The class is divided as follows:
- Introduction
- When to use a Stack?
- Stack in C++
- Stack in Python
Introduction
Perhaps you have heard about the Stack, maybe the simplest data structure from a concept point of view. The only element we can access is the element at the top of the stack, and we can only insert element at the top of the stack as well. We say that this type of structure implements the access policy LIFO (Last-In-Fist-Out), meaning that the first element to leave the Stack is the last element that entered.
To understand how the Stack works, we can imagine the Stack as a stack of cards. Where you want to add a new card to the Stack, you can only place it at the top. And if you want to take a card from the Stack, you can only take the card from the top.
As simple as this structure may seem, it is used a lot in computing to simulate recursive processes.
When to use a Stack?
The Stack structure has several practical applications like: