What is STACK data structure in C++? What is LIFO? STL Stack explained in 14 mins! DATA STRUCTURES
HTML-код
- Опубликовано: 17 июн 2024
- 📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
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.
☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. Use the link to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
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:
Instagram 📸 - / truecodebeauty
Twitter 🐦- / truecodebeauty
******CODE IS IN THE COMMENTS****** Наука
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
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
#include
using namespace std;
void printStackElements(stack stack) {
while (!stack.empty()) {
cout
Ma'am please keep uploading videos on DSA.
i like when u put all the code here not the code at the start :p it makes it easy to write it on my notepad with my pencil. It helps me remember stuff when needed.
More data structure, more algorithm stuffs we need Saldina. You rock
ye algorithms, data structures stl stuff and if someone can figure out solution to problems is what is required for interviews as junior also.
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.
I was having problems understanding stack memory in computer architecture course, and your explanation made everything clear. Thank you, really appreciate it.
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.
love how you dissected the concept of LIFO and used actual examples
this was such a good explanation, it made something that a few hours ago ive seem as complicated to something way more simpler, also i liked that there was a camera, i think that using body language made it more digestible, thank you very much!!:)
Great video as always! Keep going!!
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 :)
Here.. another informative lecture form you. Thanks very much every week!
This is a crystal clear explanation. Thank you !
Thank you for all of your time making clear and understandable lessons, they are extremely helpful and you have a wonderful way of conveying the subject you are teaching.
Very informative video for on DSA.
Please continue uploading!
i saw other videos and i didn't understand anything, about stacks you make it very easy :) thank you!!
Beautiful and smart, what more could you ask for?
Great video.
The best code teacher, I understand c++ lot better now
Thanks for the simple and great explanation. My professor made this a lot more complicated.
oh STL, thanks! There are very useful and on the internet not really a lot of videos about STL.
Such a great content! Thank you it is really helpful, keep going! you are the best
Awesome video! After seeing this I will never pronounce parameter the same way :D. Keep the good content coming!
Such a Great way to Explain Linked List . Thank you so much Mam. The Concept and Logic is Fully Cleared.
Nicely done. You speak very clearly and concisely. Easy to follow and I am sure novice programmers would learn from this. Cheers!
If anything, a dark mode of your IDE would be very nice on the eyes (and us viewers). I don't know if VS supports it; I use open source editors and they all do...
Nice to see more women in coding...
great content !!
please upload more STL .
Thank you ..
Thank you so much I needed this.You explained very well. Thank you
I dont know how to thank you seriously your lectures are amazing 😭😭
Can you please make a video about different functions dealing with single & doubly linked list such as recursion, sorting, finding particular number, comparing linked list, modyfing linked list
Its a humble request😭
great video !!
Wow, that was a great ecample of last in first out !
Great explanations!
You really are "Code Beauty" 👌
An amazing tutorial!
thanks for sharing, sharing to the world your personel experience is the greatest thing a teacher has good job love you💜💜
nice one
waiting for queue and trees maps all data structure videos by you soon
wow it was amazing explaination. thumbs up
thanks! you explained it very well
Whoa the UNDO command is a great example of STACKS used in computer science
Something that I never thought of but I have thought of a good example of recursion which are taking a photo of yourself between two mirrors and screen recording/screenshotting your desktop through multiple windows.
@@joegongamer8637i created a video explaining all those concepts you just mentioned ruclips.net/video/v-xI-hAR_Us/видео.html
Thank you so much for your great teaching of c++
thanks a lot miss Saldina well explained. mush appreciated.
Thanks for sharing such Valuable Content, That's Amazing!
You are so welcome!! 🤗🤗🧡
god bless you sister it's very important and i learn it very much
thank you, you're awesome!
More videos about data structure ❤
Thank you so much for the info
you are the best teacher and beautifull person Thanks!!!
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
Bravo Saldina, pozdrav iz Goražda 😘
Pls keep on uploading data structres tutorials
You should make a video related with Binary Trees too! So far I've enjoyed the data structures tutorials tho, keep it up!
Thanks for videos
Wow, Saldina thank you.
omg! god bless you you have covered almost everything in one video.
🤗🥰
Hello Saldina, Thank you a lot for your videos! They make learning programming really more enjoyable and I really appriciate the time you spending to make them. Actually I got one question about your study background. Did you also take Algorithms and Data Structures in your degree and could you maybe make a video about it, where you explain what the biggest challenges were for you and what tips and help you would have wished for before the module so that you could pass it successfully? It is just an idea because I am hearing from so many students they are struggeling about it. Best regards Tobias
Personally I always had trouble with Discreet Mathematics...that was tough. Data Structures was easy, as you get to use practical examples and it just makes sense. Discreet Math - very useful but hard to grasp :)
cool video, I don't really find it hard to learn the algorithms through description on leetcode although I'm a beginner but when I search for the detailed explanations on youtube or anywhere else for code implementation its an indian gargling or someone just saying nonsense that makes it harder to understand even though I already understood it. Understanding the problems is quite easy for me but what to code is harder since I don't know all my stuff I am nub. This video is fantastic, I solved an leetcode question only related by topic to stacks with it in C++ which I barely know anything about. Thanks for showing me how to use C++
Thanks Ma'am!
Thank You ❤️
Always clear.. Thx
Something I do appreciate and could agree on but somebody's gotta step in when she can't answer all of the computer programming questions the viewers have.
Mam, ur explanation is superb 👌🏻👏.......pls make videos on DP, BST ,GRAPHS,some complex concepts...................it will help us a lot....tq mam
Good video, thanks
Ohhh God
How can i tell you this video is amazing
you are too good
She is the best ❤
Clear usefull thank u
Your videos really help ma a lot
I'm happy to help! 🧡🤗
Thanks
how explain very well❤
Really helped me alot
But doing more lessons about data structure
Beautiful and great teacher , u got my sub and like
You are just osm yaar 👍🤘
Thank you for explaining all of this stuff,. Would you please continue with Data Structures and Algorithms with C++ series?
You are so helpful.
prefer so too
Keep it up ☺️
thanks you mrs
Thanks for the great lessons. Is it possible to ask if you can give a lesson in class and header and the connection white the main class.
Very clear explanation
☺️🤗
I will definitely subscribe to your channel I want to learn a lot from you, you make people understand easily
😊💜
please make a vedio covering all the data structures and thank you so much for your vedios.
Thank you Salina 🥺
thank you
Thanks again and again !!!
Always welcome! 🧡🤗
2,1
Thank you.
You're welcome! 🤗
Please make full playlist on data structures and algorithms with every variation that exists 🙏🙏🙏🙏😍😍😍😍😍👍
Thanks a lot
Please can you provide more deep
after linked lists with ptrs, this is a lot less hard, thanks Saldina!
and yet those lists was only singleton linked, and had no iterators. Add those, and lists are suddenly even harder, and _then_ stacks are childsplay
@@bearsoundzMusic why broke my dreams
thanks
Hi, Saldina! I have to solve many problems with arrays of strings in C++ and I don't quite understand them. Would you like to make a tutorial about them, please?
C++ has a header file for Stack functions?
Neat!
C was a disaster
thanks
ty
can you make more video cuz ı like it and need it
Is there a way I can see your headerfile that holds eveything in stacknumberStacks? I would like to see how you set up things like pop push top
Never mind, I didnt realize that the functions were all included in the stack and you just needed to call them. Thank you for the video
so helpful thanks saldina
Kevin you're welcome! 🤗
curious why we dont have to use reference operator (&) when we pass "stack stack" to printStackElements() if anyone sees this and wants to lecture me lol
@@kevinz1991 I'm not sure. Maybe it's because classes and objects uses something like this->attribute instead of this.attribute? Whereas regular variables aren't automatically referenced? I'm sorta confused about it too.
What I know for sure is the stack elements were never modified in the function she created. Her function probably took a copy of the original stack from the main method.
You are simply the best😍🥰😘
Thank you so much! 🧡🤗
@@CodeBeauty am looking forward for a full course on data structure and algorithm in c++🙂
Thanks in advance ☺
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
I have always been interested in knowing how the stack and heap work in programming but with a hardware reference approach. What are the advantages or disadvantages of hosting information on the stack or heap?
In short:
1. Stack is used for storing of local variables. Pros: easy to push (just increase stack pointer (esp register) to the amount of bytes needed); freed automatically when function returns (in function epilogue) => object's destructor is called as soon as local variable goes out of scope; Cons: relatively small => stack overflow exception when there is no enough memory
2. Heap is used for "long-lived" variables in most cases. Pros: huge size; Cons: slower, because to allocate memory allocator has to find an empty block of memory; allocation/deallocation has to be done manually: new/delete, malloc/free => quite easy to get memory leak
Great content! Just have one question. Could you make some explanation why `pop` of `printStackElements` didn't pop out elements as line 18? Thanks
Saldina je l si iz Bosne? Hvala ti mnogo na videima! Samo napred lutko!
Please make a tutorial on how to make a program that reads data from text file
I like to think of the rule of stacks like *F*irst In *L*ast out. First in as in the first element gets into the stack. Last out as in the most recent element that has entered the stack gets out of the stack first. As long as our different interpretations have the same meaning, then I'd say I'm not far away from its definition.
Keep posting plzzzzzzzz
last in first out. meaning that the most recent input is on the top of stack when reading left to right and top to bottom.
Outclass mam love from Pakistan 🇵🇰
The elements avail in stack is 1 2
ok this is well explained, even if sometimes you could jump some details. an example where it is put into practice would be useful.
#include
#include
typedef unsigned long long int XXL; //predefined type, used for visibility
using namespace std;
int main(){
cout
Thank you so much. How to print reverse order of elements?
That's a good question. The rules of the stack only lets you access the top element, which makes accessing any elements less flexible. I'd say arrays have a good flexibility of accessing elements since there's no "strict" rule of how to access them. So, to print the reverse order of the elements from the stack, the only way I can think of is to transfer the stack elements into an array. Use a for loop to have this array print its elements from the last index to the first index. Of course, you can have this strat in a function. Hope that helps.