What is STACK data structure in C++? What is LIFO? STL Stack explained in 14 mins! DATA STRUCTURES

preview_player
Показать описание
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️

Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

Want to learn stack data structure in under 15 minutes? In this video, I'm explaining what is stack, how to work with the STL stack in C++, what are real-life examples of stack use, and more.
You will also learn what is LIFO technique.

A stack is a type of data structure that uses LIFO (Last In - First Out) technique to store elements. This means that new elements are added at one end (top) and elements can be removed from that end only.
Other commonly used synonyms for the LIFO technique are FILO (First In - Last Out) and LCFS (Last Come - First Served)

In this video, I'll also explain the five most important functions that you need to know if you want to work with stack data collections.
Those are: empty, size, push, pop, top.

Contents:
00:00 - Introduction
00:20 - What is Stack? What is LIFO?
01:30 - Example of stack use in real life
02:51 - Functions used to work with stack
03:46 - Implementation and working with STL Stack
09:21 - How to write out elements of the stack

Add me on:

*******CODE IS IN THE COMMENTS*******
Рекомендации по теме
Комментарии
Автор

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

#include <iostream>
#include<stack>
using namespace std;

void printStackElements(stack<int> stack) {
while (!stack.empty()) {
cout << stack.top() << endl;
stack.pop();
}
}

int main()
{ //empty, size, push, pop, top
stack<int>numbersStack;
numbersStack.push(1);
numbersStack.push(2);
numbersStack.push(3);
numbersStack.pop();



if (numbersStack.empty())
cout << "Stack is empty"<<endl;
else
cout << "Stack is not empty" << endl;
cout << "Stack size is " << numbersStack.size() << endl;

system("pause>0");
}

CodeBeauty
Автор

More data structure, more algorithm stuffs we need Saldina. You rock <3

mdmobarokrubel
Автор

Love how you give us a real application example of stack. If you could do more that it be great. Sometimes trying to see c++ in action in software is hard to find.

jdkingsley
Автор

Whoa the UNDO command is a great example of STACKS used in computer science

SavageScientist
Автор

Hello from Syria Saldine
All thanks to you for the useful lessons you offer, with simple explanations.
I hope you continue with the lessons of data structures and not delay with the lessons. Thank you.

mohammadhawa
Автор

love how you dissected the concept of LIFO and used actual examples

MonCarlo
Автор

Very informative video for on DSA.
Please continue uploading!

tyson
Автор

The best code teacher, I understand c++ lot better now

ComputerGuru-tkhg
Автор

This is a crystal clear explanation. Thank you !

boyar
Автор

I was having problems understanding stack memory in computer architecture course, and your explanation made everything clear. Thank you, really appreciate it.

oussamabourouaiah
Автор

Beautiful and smart, what more could you ask for?
Great video.

emihernandez
Автор

oh STL, thanks! There are very useful and on the internet not really a lot of videos about STL.

dimaferox
Автор

Thanks for sharing such Valuable Content, That's Amazing!

mrzaidivlogs
Автор

13:13 my answer is 2, 1 cause stack is last in first out, the last element we inserted is 3 therefore it will be the first element that will be removed when we perform the pop function

tanny_edits
Автор

THANK YOU MUCH, u made it look super easy, GOD BLESS YOU

theweeknd
Автор

Here.. another informative lecture form you. Thanks very much every week!

정민강-rs
Автор

today in my university our lecturer talked about stack but I did not get anything from her, but after this video, i can say I am 100% understand your video now i am a (zoolly stack) in English means I am quite fully understand

wshacode
Автор

i passed my intro to c++ class with flying colors this term! can't wait for next term when we move on to more advanced topics :)

celestiaaldreaams
Автор

Such a Great way to Explain Linked List . Thank you so much Mam. The Concept and Logic is Fully Cleared.

shreyashpatil
Автор

after linked lists with ptrs, this is a lot less hard, thanks Saldina!

roros