Тёмный

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

CodeBeauty
Подписаться 277 тыс.
Просмотров 94 тыс.
50% 1

📚 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.
Download Visual Assist here: bit.ly/WT-CB
I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
Download Ultra Edit here: bit.ly/UE-CB
It is a powerful, secure text editor designed specifically for programmers.
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******

Наука

Опубликовано:

 

5 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 232   
@CodeBeauty
@CodeBeauty 3 года назад
📚 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
@tyson3465
@tyson3465 3 года назад
Ma'am please keep uploading videos on DSA.
@GenjaOrigins
@GenjaOrigins 3 года назад
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.
@mdmobarokrubel2635
@mdmobarokrubel2635 3 года назад
More data structure, more algorithm stuffs we need Saldina. You rock
@GenjaOrigins
@GenjaOrigins 3 года назад
ye algorithms, data structures stl stuff and if someone can figure out solution to problems is what is required for interviews as junior also.
@jdkingsley6543
@jdkingsley6543 3 года назад
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.
@oussamabourouaiah6134
@oussamabourouaiah6134 3 года назад
I was having problems understanding stack memory in computer architecture course, and your explanation made everything clear. Thank you, really appreciate it.
@mohammadhawa337
@mohammadhawa337 3 года назад
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.
@heatherdouglas9493
@heatherdouglas9493 Год назад
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.
@boyar3033
@boyar3033 Год назад
This is a crystal clear explanation. Thank you !
@MonCarlo
@MonCarlo 3 года назад
love how you dissected the concept of LIFO and used actual examples
@terenchosi1040
@terenchosi1040 3 года назад
Great video as always! Keep going!!
@wadalapichu4873
@wadalapichu4873 2 года назад
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!!:)
@tyson3465
@tyson3465 3 года назад
Very informative video for on DSA. Please continue uploading!
@user-tz1no1kv6u
@user-tz1no1kv6u 3 года назад
Here.. another informative lecture form you. Thanks very much every week!
@edakimling133
@edakimling133 3 года назад
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...
@mereyjumabekova1471
@mereyjumabekova1471 2 года назад
Such a great content! Thank you it is really helpful, keep going! you are the best
@emihernandez8784
@emihernandez8784 3 года назад
Beautiful and smart, what more could you ask for? Great video.
@SavageScientist
@SavageScientist 3 года назад
Whoa the UNDO command is a great example of STACKS used in computer science
@joegongamer8637
@joegongamer8637 2 года назад
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.
@SavageScientist
@SavageScientist 2 года назад
@@joegongamer8637i created a video explaining all those concepts you just mentioned ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-v-xI-hAR_Us.html
@ComputerGuru-tk2hg
@ComputerGuru-tk2hg 8 месяцев назад
The best code teacher, I understand c++ lot better now
@shreyashpatil3728
@shreyashpatil3728 Год назад
Such a Great way to Explain Linked List . Thank you so much Mam. The Concept and Logic is Fully Cleared.
@PinkSokka
@PinkSokka 2 года назад
Thanks for the simple and great explanation. My professor made this a lot more complicated.
@guaicaipurouzumaki7654
@guaicaipurouzumaki7654 2 года назад
i saw other videos and i didn't understand anything, about stacks you make it very easy :) thank you!!
@joakim1745
@joakim1745 2 года назад
Thank you so much I needed this.You explained very well. Thank you
@anthonyhill9093
@anthonyhill9093 Год назад
Great explanations!
@lickguitars1276
@lickguitars1276 3 месяца назад
thanks for sharing, sharing to the world your personel experience is the greatest thing a teacher has good job love you💜💜
@mrzaidivlogs
@mrzaidivlogs 3 года назад
Thanks for sharing such Valuable Content, That's Amazing!
@CodeBeauty
@CodeBeauty 3 года назад
You are so welcome!! 🤗🤗🧡
@abdullahzahid8660
@abdullahzahid8660 2 года назад
you are the best teacher and beautifull person Thanks!!!
@dimaferox5133
@dimaferox5133 3 года назад
oh STL, thanks! There are very useful and on the internet not really a lot of videos about STL.
@sandipan17
@sandipan17 2 года назад
You really are "Code Beauty" 👌 An amazing tutorial!
@mthandazonkomo1975
@mthandazonkomo1975 Год назад
Thank you so much for your great teaching of c++
@codebasic8558
@codebasic8558 2 года назад
Awesome video! After seeing this I will never pronounce parameter the same way :D. Keep the good content coming!
@WVBSSSID
@WVBSSSID 3 года назад
great content !! please upload more STL . Thank you ..
@celestiaaldreaams
@celestiaaldreaams 3 года назад
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 :)
@GlobStats
@GlobStats 2 года назад
thanks a lot miss Saldina well explained. mush appreciated.
@_skyykim500
@_skyykim500 3 года назад
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😭
@prabhathsannasooriya
@prabhathsannasooriya Год назад
wow it was amazing explaination. thumbs up
@hazel5835
@hazel5835 2 года назад
thanks! you explained it very well
@sslvsme5763
@sslvsme5763 7 месяцев назад
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++
@husseinalim6916
@husseinalim6916 3 года назад
god bless you sister it's very important and i learn it very much
@imrannabame4792
@imrannabame4792 2 года назад
omg! god bless you you have covered almost everything in one video.
@CodeBeauty
@CodeBeauty 2 года назад
🤗🥰
@arjunsekarsd
@arjunsekarsd 2 года назад
Thank you so much for the info
@bizio12
@bizio12 3 года назад
Always clear.. Thx
@joegongamer8637
@joegongamer8637 2 года назад
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.
@nahiansharif4200
@nahiansharif4200 2 года назад
Wow, that was a great ecample of last in first out !
@lucasfernandes5775
@lucasfernandes5775 3 года назад
great video !!
@mmaranta785
@mmaranta785 3 года назад
Very clear explanation
@CodeBeauty
@CodeBeauty 3 года назад
☺️🤗
@Calmalor
@Calmalor 3 года назад
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
@edakimling133
@edakimling133 3 года назад
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 :)
@abugslife2461
@abugslife2461 Год назад
thank you, you're awesome!
@syncwithnature73
@syncwithnature73 2 года назад
I will definitely subscribe to your channel I want to learn a lot from you, you make people understand easily
@CodeBeauty
@CodeBeauty 2 года назад
😊💜
@wshacode7179
@wshacode7179 2 года назад
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
@adelinbonheurnsengiyumva5546
@adelinbonheurnsengiyumva5546 3 года назад
Thanks Ma'am!
@mahadevsai3748
@mahadevsai3748 3 года назад
Mam, ur explanation is superb 👌🏻👏.......pls make videos on DP, BST ,GRAPHS,some complex concepts...................it will help us a lot....tq mam
@mahmoud-khaled-abo-elmagd
@mahmoud-khaled-abo-elmagd 3 года назад
nice one waiting for queue and trees maps all data structure videos by you soon
@cheetahalpha4648
@cheetahalpha4648 3 года назад
Your videos really help ma a lot
@CodeBeauty
@CodeBeauty 3 года назад
I'm happy to help! 🧡🤗
@vimbichiradza5155
@vimbichiradza5155 Год назад
She is the best ❤
@yohansenurga4044
@yohansenurga4044 3 года назад
Wow, Saldina thank you.
@vagifasadov3128
@vagifasadov3128 Год назад
Thank you for explaining all of this stuff,. Would you please continue with Data Structures and Algorithms with C++ series? You are so helpful.
@ComputerGuru-tk2hg
@ComputerGuru-tk2hg 8 месяцев назад
prefer so too
@yusufrahimov9160
@yusufrahimov9160 Год назад
Thanks for videos
@klevialushi571
@klevialushi571 3 года назад
You should make a video related with Binary Trees too! So far I've enjoyed the data structures tutorials tho, keep it up!
@johnpaulbancayrin6195
@johnpaulbancayrin6195 3 года назад
More videos about data structure ❤
@tanny_edits
@tanny_edits Год назад
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
@cheetahalpha4648
@cheetahalpha4648 3 года назад
Thanks
@nomannoman2492
@nomannoman2492 3 года назад
Thank You ❤️
@AlaniHill
@AlaniHill 2 года назад
Beautiful and great teacher , u got my sub and like
@actor19927
@actor19927 3 года назад
Bravo Saldina, pozdrav iz Goražda 😘
@moularaoul643
@moularaoul643 3 года назад
Thanks again and again !!!
@CodeBeauty
@CodeBeauty 3 года назад
Always welcome! 🧡🤗
@jahangirshah9344
@jahangirshah9344 3 года назад
2,1
@conceptwithayan4737
@conceptwithayan4737 Год назад
how explain very well❤
@philtoa334
@philtoa334 3 года назад
Thank you.
@CodeBeauty
@CodeBeauty 3 года назад
You're welcome! 🤗
@danny12345
@danny12345 3 года назад
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.
@brandongregory7576
@brandongregory7576 2 года назад
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
@brandongregory7576
@brandongregory7576 2 года назад
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
@ZeroCool2211
@ZeroCool2211 3 года назад
Pls keep on uploading data structres tutorials
@alexandruteodor3585
@alexandruteodor3585 3 года назад
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?
@roros2512
@roros2512 3 года назад
after linked lists with ptrs, this is a lot less hard, thanks Saldina!
@bearsoundzMusic
@bearsoundzMusic 2 года назад
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
@roros2512
@roros2512 2 года назад
@@bearsoundzMusic why broke my dreams
@hmd2372
@hmd2372 7 месяцев назад
Clear usefull thank u
@johnsknows3135
@johnsknows3135 Год назад
thank you
@tonyx8613
@tonyx8613 3 года назад
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?
@antonmakeyenko4018
@antonmakeyenko4018 3 года назад
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
@mejmanat4845
@mejmanat4845 3 года назад
Good video, thanks
@rishabjain6452
@rishabjain6452 3 года назад
C++ has a header file for Stack functions? Neat! C was a disaster
@animeshpandey1331
@animeshpandey1331 3 года назад
please make a vedio covering all the data structures and thank you so much for your vedios.
@user-td4pf6rr2t
@user-td4pf6rr2t Месяц назад
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.
@bagaspermana88
@bagaspermana88 2 года назад
thanks
@zerobrucezero
@zerobrucezero Год назад
13:20 The int 3 will be popped out of the stack, the ints 2 and 1 will remain in the stack
@theweeknd6906
@theweeknd6906 7 месяцев назад
THANK YOU SOOOOO MUCH, u made it look super easy, GOD BLESS YOU
@CodeBeauty
@CodeBeauty 7 месяцев назад
Glad it helped!
@cabdiraxmaankhaliiftahliil9217
@cabdiraxmaankhaliiftahliil9217 3 года назад
Really helped me alot But doing more lessons about data structure
@joegongamer8637
@joegongamer8637 2 года назад
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.
@sonalibachhav9229
@sonalibachhav9229 3 года назад
Ohhh God How can i tell you this video is amazing you are too good
@thetypicalone2525
@thetypicalone2525 2 года назад
Please make full playlist on data structures and algorithms with every variation that exists 🙏🙏🙏🙏😍😍😍😍😍👍
@kevinz1991
@kevinz1991 3 года назад
so helpful thanks saldina
@CodeBeauty
@CodeBeauty 3 года назад
Kevin you're welcome! 🤗
@kevinz1991
@kevinz1991 3 года назад
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
@joegongamer8637
@joegongamer8637 2 года назад
@@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.
@joborfrederick4312
@joborfrederick4312 2 года назад
Thank you Salina 🥺
@safaamaz
@safaamaz Год назад
thanks you mrs
@ahmadmohamad8416
@ahmadmohamad8416 2 года назад
ty
@zainulabideen5595
@zainulabideen5595 Год назад
Keep it up ☺️
@khalidessamoudi2291
@khalidessamoudi2291 3 года назад
Thanks a lot Please can you provide more deep
@eenugaming
@eenugaming 3 года назад
Please make a tutorial on how to make a program that reads data from text file
@krishsharma6276
@krishsharma6276 3 года назад
You are just osm yaar 👍🤘
@1conscience0dimension
@1conscience0dimension 3 года назад
ok this is well explained, even if sometimes you could jump some details. an example where it is put into practice would be useful.
@1conscience0dimension
@1conscience0dimension 3 года назад
#include #include typedef unsigned long long int XXL; //predefined type, used for visibility using namespace std; int main(){ cout
@chibuezekennedy3127
@chibuezekennedy3127 3 года назад
You are simply the best😍🥰😘
@CodeBeauty
@CodeBeauty 3 года назад
Thank you so much! 🧡🤗
@chibuezekennedy3127
@chibuezekennedy3127 3 года назад
@@CodeBeauty am looking forward for a full course on data structure and algorithm in c++🙂 Thanks in advance ☺
@yuwang6469
@yuwang6469 Год назад
Great content! Just have one question. Could you make some explanation why `pop` of `printStackElements` didn't pop out elements as line 18? Thanks
@quanm7077
@quanm7077 2 года назад
thanks
@adroaldoferreira978
@adroaldoferreira978 3 года назад
Thank you so much. How to print reverse order of elements?
@joegongamer8637
@joegongamer8637 2 года назад
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.
@manoharsagunthalla9215
@manoharsagunthalla9215 3 года назад
The elements avail in stack is 1 2
@cereais5586
@cereais5586 3 года назад
Can you make a video about array of char vs string pls? I tend to have a lot of problems with strings on c++
@youssofprogrammer7546
@youssofprogrammer7546 Год назад
yes i think he should do that
@suleymankocamaz3743
@suleymankocamaz3743 3 года назад
can you make more video cuz ı like it and need it
Далее
Кто понял тот понял
00:24
Просмотров 325 тыс.
Stack vs Heap Memory in C++
19:31
Просмотров 555 тыс.
Stack Data Structure In STL | C++ Tutorial
16:59
Просмотров 10 тыс.
Rust Functions Are Weird (But Be Glad)
19:52
Просмотров 129 тыс.
Generics: The most intimidating TypeScript feature
18:19
Learn Stack data structures in 10 minutes 📚
10:07
Просмотров 189 тыс.
All Rust features explained
21:30
Просмотров 289 тыс.
Pointers and dynamic memory - stack vs heap
17:26
Просмотров 1,4 млн
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
Просмотров 168 тыс.