Meet Jain🦅(🛠️,⛓️) Profile picture
21 | Blockchain🔗 | Web3 | DSA |💻 Follow to learn 🚀 Cofounder @0xSaturnHQ_ | Github: https://t.co/e3AtfUSxEk My followers are called Celestials!

Sep 13, 2021, 16 tweets

Some real-world examples of the Data structure "Stack"👇

A thread🧵

Stack is a LIFO (Last In First Out) data structure.

🔸A pile of books is an example of a stack. The last book kept on the pile will be removed first i.e LAST IN FIRST OUT (LIFO) data structure

🔸A pile of plates

🔸Stack of chairs

🔸Tower of Hanoi: Famous application of stack

🔸Activities (Screens) in your Android app are arranged in a stack (the back stack) in the order in which each activity is opened.

An example continued 👇

An email app might have one activity to show a list of new messages.
When the user selects a message, a new activity opens to view that message which is added to the back stack.
If the user presses the Back button, that new activity is finished and popped off the stack

🔸Women bangles - Women wear a bangle one by one and to pull the first one they have to first pull out the last one.

🔸Web browsers use the stack to keep track of the history of websites. If you click back then the previous site opens immediately.

🔸Call logs in mobiles use the stack (in which the recent call is on the top)

🔸When a company wants to reduce its workforce. Typically they follow "Last Hired First Fired"

🔸Function call uses the stack

🔸Matching of brackets by the compiler is also implemented using stack.

This is the end of the thread.

Real-life examples for other data structures coming soon. Be sure to give a follow to @meetjain74

Also if you liked this Retweet the first tweet

And let me know your thoughts below on this

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling