Тёмный

Stack Data Structure | JavaScript 

Traversy Media
Подписаться 2,3 млн
Просмотров 98 тыс.
50% 1

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

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 320   
@TraversyMedia
@TraversyMedia 4 года назад
This will be an ongoing series. I know it is a bit different than the projects/crash courses I usually do, but it is really good practice. I will be reviving the JS Cardio series as well. Maybe do some Codewars :)
@tomershechner
@tomershechner 4 года назад
I'll just lay a couple of DSes ideas for your next videos: - Hash tables (associative arrays, aka maps) - Dynamic array (aka vectors) - Binary trees - Queues - Heaps - Sets I implemented them all in C once, it'll be cool to see you using a language other than JS, something which is closer to the metal, like C, Rust or even Go. Peace Brad, I appreciate the effort you put into your videos!
@swanstudios2018
@swanstudios2018 4 года назад
Traversy Media love some code wars that would be a nice mix of content! Thanks so much brad!
@khotambakhromov
@khotambakhromov 4 года назад
how the method pop removes element? tbh, I couldn't find out how it works and deletes item
@Buyilehuorg
@Buyilehuorg 4 года назад
shouldn't we add this.items.pop() inside pop method? otherwise it's kinda still there, no? Could you please make examples how to use those with real world implications? I mean examples explaining why we want to use it instead of arrays for instance etc. Thank you very much for your videos and Udemy courses
@princesiful
@princesiful 4 года назад
great
@Ath9394
@Ath9394 4 года назад
Really happy that brad started data structure series
@ryan.aquino
@ryan.aquino 4 года назад
Please continue this series: data structures and algs. Include stack, queues , heap , graph , trees. You explain things simpler than others ! Thanks. Edit: Include atleast 1 coding problem And 1 realworld example.
@uchechukwuprincenwulu2026
@uchechukwuprincenwulu2026 4 года назад
im in support with his comment
@michaelolukaka
@michaelolukaka 4 года назад
waiting for the next data structure...good stuff
@EngerJimenez
@EngerJimenez 4 года назад
I support this.
@toberixng
@toberixng 4 года назад
that is the honest truth
@EntwistleOx
@EntwistleOx 4 года назад
support!
@safara_umarov
@safara_umarov 4 года назад
Really! You are great teacher in the RU-vid I'm from Tajikistan and I started learning programming with your videos and now I know many many things. Thank you my brother❤)). With our language not one video about programming and I don't know English good! Your videos help me very. Thank you again
@tom.watkins
@tom.watkins 4 года назад
Great video, only thing that I was surprised to see was the pop method not actually reducing the size of the internal array. Looking forward to the other videos in the playlist!
@iamjameswong
@iamjameswong 4 года назад
Hey, nice vid. If I understand it correctly the `.pop` method merely reduces the reference count instead of actually removing the item from the list/stack. Is that right?
@srdjagunjic
@srdjagunjic 4 года назад
Same...
@jeromesnail
@jeromesnail 4 года назад
The way the stack works, it is exactly like the item was removed from the stack, even if it is still in the items array. Because we're not supposed to access items from outside of the class.
@greenie62
@greenie62 4 года назад
ya i was thinking that too and playing around to try to 'break it'...i realized and am curious for someone to confirm, but in this instance pop feels like its.a rewrite method rather then a remove...by that i mean, it gives us the value but rather then remove it, it just backs the counter up one so the next item we push(), it will then overwrite it as its being given the same index value. so, if you pop() and then look at the array right after, the item is still in there, but soon as you push, then its becomes 'gone' and your stack continues on with its indexed integrity. least thats my guess!
@augustodias8986
@augustodias8986 4 года назад
I just added this.items[this.count] = undefined after decrementing the count
@frankkevintankui7221
@frankkevintankui7221 4 года назад
Same. 😅 It's a great mistake. We also have to manage the memory in data structure
@thedanphillips
@thedanphillips 4 года назад
Honestly the fact that you still provide free stuff on YT and not just Udemy is the best. I'm already familiar with Stacks but it's nice to see your content quality is great even when it's free! Keep it up, more people like you in the world is what we need.
@santosokwadi
@santosokwadi 4 года назад
Every Video this guys posts, I just click "Like" even before I watch. You have great content Man.
@jmmacatangay_grizzlybear
@jmmacatangay_grizzlybear 4 года назад
It's really amazing how people come into your channel. It's about 21 minutes ago in my time and a hundred people seen it already. It's really amazing that a lot of people appreciate you. Been telling my friends about your channel. Really hoping you'll get a billion subscriber someday.
@Unbridledhopebr
@Unbridledhopebr 4 года назад
Hey, I AM A BIG fan of your work. I can easily understand what you teach. thank you very very much for selling your courses at such an affordable price and outstanding quality. Hug from Brazil.
@soumadip_banerjee
@soumadip_banerjee 4 года назад
Yaaayyy! Plz! Connect these data structure videos in a series! (small tip: Add some theory too). U're again, my hero in the Tech world! Thankeeww so much! I needed this! 💚
@leod.9343
@leod.9343 4 года назад
We want more data structures and algos ! Please Brad !
@jaleotech5918
@jaleotech5918 4 года назад
pop in the example not actually removing anything.. if you con log items they are all still there. The only thing that is going on is the changing of the counter not the actual array..
@mykalimba
@mykalimba 4 года назад
Why does it matter? It is _effectively_ removed, from the perspective of whoever is using the API for this class.
@vegitax
@vegitax 4 года назад
@@mykalimba no, it's not. It matters a lot because the values are still in the memory and only the 'pointer' moves and that's not how a stack should work. If this was in a production env somewhere it would undoubtly cause problems at some point.
@vegitax
@vegitax 4 года назад
It bothered me for the whole video that the values were not deleted. I was waiting for the whole time for Brad to notice it because he usually does 😅
@kumarraja1989
@kumarraja1989 4 года назад
Exactly, I am looking for the solution
@norricobiason5821
@norricobiason5821 4 года назад
@@mykalimba you want to see how isn't popping element in the stack? insert this in pop() method let deleteItem = this.items[this.count - 1]; this.count -= 1; console.log(`${deleteItem} removed`); console.log(`${this.items}`);
@_rachid
@_rachid 4 года назад
Thank you Mr Brad for this. By the way your course Javascript from the beginning on udemy is gold 👌 Greetings from Morocco 🇲🇦
@andrewiglinski148
@andrewiglinski148 4 года назад
Dude I was just messing with react-navigator for react native when I saw this. As soon as I saw this I kind of pee'd a little from overwhelming excitement.
@eduriseworld
@eduriseworld 4 года назад
Awesome awesome. I'm going to start videos on Leetcode problems as well. Have my Facebook interview on 8th. Will definitely check these DS videos of yours. :)
@eduriseworld
@eduriseworld 4 года назад
BTW All, Facebook Enterprise Team is hiring like crazy at the moment. Pick a Facebook Recruiter from LinkedIn and send them a message that you want to join the "Enterprise Team", they will hook you up with the right department. Feel free to ask me if you need help. Can't help you get an interview right away, but can definitely guide the way in which you can get an interview. I don't work at Facebook (yet!)
@tomershechner
@tomershechner 4 года назад
@@eduriseworld Good luck man, let us all now when you get hired! (maybe you'll replace Zuckerberg, who knows ;D ?)
@LabaranLabs
@LabaranLabs 4 года назад
@@tomershechner sure
@paschalynukwuani6980
@paschalynukwuani6980 2 года назад
Thank you so much for this video. I really understood everything. I must say you are a good teacher. Love your content 💓
@eriktenecela7170
@eriktenecela7170 4 года назад
Bro thanks Traversy man I been telling people these DS/Algorithms are the most important thing to know before anything it will improve your programming mindset dramatically thanks again this channel truly is the best
@mauricioreyes8912
@mauricioreyes8912 4 года назад
Dude, Im coursing data structures in the collegue now, you have this skill to explain things really good. Keep going. Really great channel.
@mannyc1065
@mannyc1065 4 года назад
I'm taking a data Structures course at school next semester so this is perfect timing!! Thank you!
@barathraj9803
@barathraj9803 4 года назад
Wow thank you so much... I was not confident about DS before but now i am sure that i will understand everything.. Thanks, please upload all the vedios exlpaining all the Dta structures.!!
@Melanittanigra
@Melanittanigra 4 года назад
Please continue with this series, it is very hard to find information on algorithms and data structures in regards to JavaScript
@GTsurwa
@GTsurwa 4 года назад
So glad you are doing stuff like this Brad. Still yet to find a web dev job, so videos where I can keep learning really help keep motivated. Thank you 1000 times.
@shutdownyes
@shutdownyes 4 года назад
Thanks, Brad! Really glad to see your videos about Data Structure! Strongly waiting for the rest videos in this area!
@swarnalathavura1334
@swarnalathavura1334 4 года назад
I'm new to this channel recently I joined but it's very nice waiting for more videos I'll support u
@abualmahadi8084
@abualmahadi8084 4 года назад
Now that you've started the series I'm already feeling confident about finally learning about the data structure and algorithm......sooo much love and respect
@NiranjanAS-k6y
@NiranjanAS-k6y 9 месяцев назад
Pop method is not removing the item from the array. It just returns the top item of the stack.
@rezamarefat6894
@rezamarefat6894 4 года назад
Please keep making these kinda content brad. Your channel is incredible
@maxhouseman3129
@maxhouseman3129 4 года назад
Pop does not really delete it from memory. It only decreases the counter, but in raw data the element is still existing.
@marufahmed7314
@marufahmed7314 4 года назад
Right, the item is still there
@TheNerdyDev
@TheNerdyDev 4 года назад
Something different. That's great, Brad. What a coincidence, I too was working on a data structure tutorial series but with Java language.
@MeTr1ckZUCSGO
@MeTr1ckZUCSGO 4 года назад
pop is not removing items from the stack, we just change 'count' pointer hiding the bug and potential memory leakage.
@rasulyakubov1461
@rasulyakubov1461 4 года назад
I think a new ERA is going to begin for Traversy Media Students and for Brad too :)
@indomitablelust
@indomitablelust 4 года назад
I got a little confused here. Why is the pop method not actually removing the element from the stack? I was thinking that the original stack may still have all the pushed elements at the end but I'm not competely sure. Could someone please explain that part to me? Excelent content as always, keep up the good work, man.
@xXDameanXx
@xXDameanXx 4 года назад
Many thanks for creating this content and sharing this knowledge, algorithms, and design patterns are needed out there but no one is teaching them
@benomayio3666
@benomayio3666 2 года назад
Thanks man! I always enjoy your tutorials
@amalekilawlor2922
@amalekilawlor2922 2 года назад
This pop doesn’t modify the items array, which isn’t a big deal, but you can also write the pop method as: pop(){ if (this.count == 0) return undefined; this.items.splice(this.count - 1); return this.count -= 1; }
@frugodwill
@frugodwill 2 года назад
Yeah I think he intentionally didn’t want to mutate the original array. More like the global array methods that don’t mutate original arrays
@annyudo
@annyudo 2 года назад
Thank you so much, I really enjoy all your videos, the concepts you use and your explanations are very concise. You are a great teacher. Pls keep up the good work.
@feruttin
@feruttin 4 года назад
Hi, you could start this.count = -1 and increment it before assigning. so there will not be mess with indexes.
@TheCredibleHulk
@TheCredibleHulk 4 года назад
I might be wrong, but I think your pop() was lacking some essential garbage collection features. Cos until you clear() the stack, data is still all there in the items array, only the count changes. It might lead to some unexpected results + is just a waste of resources, if you have a large stack. The pop() function should get the top element + remove it from the array altogether.
@akiratoriyama1320
@akiratoriyama1320 4 года назад
This is great tutorial sir!! You are helping with our computing thinking!! Thank you!! Hope you made a whole series on data structures because you explain things on simple way!!
@AneesKhan-uz4mz
@AneesKhan-uz4mz 4 года назад
I always feared data structures and algorithms but Brad you just explained really well now I'm loving data structures and algorithms ❤️❤️
@onedimensionalchess4373
@onedimensionalchess4373 4 года назад
Beautiful!! I’m about to get into this topic, so it’s nice to see my favorite teacher explaining it.
@joeyalfaro2323
@joeyalfaro2323 3 года назад
im going to give you some real feed back i couldn't wrap my head around what code was doing slowly pieces came together at this point. i got captions on taking notes and hand writing examples. i wondered what numbers on side were and little screens. it slowly comes together throw more time at problem break it down step back really dig in.
@sushantkunkekar2155
@sushantkunkekar2155 4 года назад
One of the best and simple video on stack... Please Brad do videos on other data structures too. Likr hashtable , tree, dynamic programming
@bren.r
@bren.r 4 года назад
It seems counterproductive to make a wrapper class for the built in methods of Array, besides syntactic sugar, at the expense of more memory allocation as you’re not letting the stale elements to be garbage collected as your example shows.
@gihantharatnayake3411
@gihantharatnayake3411 4 года назад
Hey Brad. Pop doesnt actually remove the elements from the array. It looks correct cus the count value decreases. If you print the array at the end you will find all the elements are still there.
@cristlui4
@cristlui4 4 года назад
Are you a mind reader? This is truly fantastic. Thank you so much Brad!
@mudusugal
@mudusugal 4 года назад
your explanations are very clear and easy to understand. Thank you!
@timurgolovinov
@timurgolovinov 4 года назад
It would be great if you can also explain where they can be useful in real-world applications, please Brad!
@arjitamathur4718
@arjitamathur4718 4 года назад
Sir please teach all data structures and algorithms ! I am a learner from *INDIA* . I really like your videos and the way you teach. It's really helpful sir . It's a request that please make a data structure series in which we get in depth knowledge of the course .Thankyou Sir .. Really grateful to u !
@cubedev4838
@cubedev4838 3 года назад
Please continue this kind of series
@jeanssmith5864
@jeanssmith5864 4 года назад
me too Really happy that brad started data structure series I will be right here waiting for Brad
@andrei8299
@andrei8299 4 года назад
Thanks for the video. Just today got to this topic while learning. It was interesting to know how the mothods structured
@RyanRoat
@RyanRoat 4 года назад
The BaseCS podcast has a number of episodes on data structures. They provided a great description of the stack - a spring loaded dish stacker in a cafeteria. The cafeteria pushes the dishes onto the stack, and the diners pop them off when they queue up. Oh, look, there's another data structure. :) And yes, I'd like a look at tests to verify the stack is working as expected.
@captainmeme9476
@captainmeme9476 4 года назад
hope one day you are not going to left us , without telling even a goodbye , your are an inspiration for a lot of people who are struggling in their life , am living in a place where tech and programming stuff are impossible to learn and accecible only for extra-rich people , i had and i still have a lot of different problems in my life but with you guys (dev dd , web dev...) my vision about life has changed and am determined to do my best , hope one day we are going to meet and speak like friends . #devTips #thenewboston...........
@JamieMcGibbon
@JamieMcGibbon 4 года назад
Great video! Thanks for taking the time to put it together! Looking forward to the others in the series!
@xaviguasch
@xaviguasch 4 года назад
This is great! I always wanted Brad to tackle data structures and algorithms in JS, please continue.
@romanahmed5655
@romanahmed5655 4 года назад
Wow..... Nice series .Thank you brad.
@retr0477
@retr0477 4 года назад
Wow please keep releasing these Data Structures & Algorithms videos. I really appreciate it bro
@sujeetagrahari2292
@sujeetagrahari2292 4 года назад
I am so glad that you doing this. I have been following this channel very long. I don't come here often now. To be honest best channel for beginners to learn new techs. But code quality and best practices lack in this channel, and I don't think this should be a concern when you are introduced something new at first. But if you get a idea of things in the beginning, it will be lot more beneficial for newcomers..
@woozy_deer
@woozy_deer 4 года назад
Thanks! I love these data structures videos
@HermanRas
@HermanRas 4 года назад
can't do full stack without understanding how to properly structuring the data, its the differences between complete redesign or adding and object... so love to see more video's in this style.. PS - there is a memory leak in the pop function, you are reducing the count number without removing the actual item :)... probably not a big deal but if you scale the function to a million and change out the numbers for large pictures... your node server will fall over and DIE..
@theartist8835
@theartist8835 4 года назад
Hey Brad! Thanks for the amazingly put content. I just wanna say that you forgot to remove the last elemnt from the items array in the pop method!
@praveengautam4689
@praveengautam4689 2 года назад
yes i am stuck in pop method can you please explain the correction in pop method
@judeokagu6757
@judeokagu6757 4 года назад
Finally 😀 Brad to the world 🌎
@truphenalwanga9829
@truphenalwanga9829 4 года назад
Can' t wait to see more on this series. Great start.
@N63B44
@N63B44 4 года назад
Great video like always Brad! In 4:24 instead of those two lines 10 and 11 you could write : return this.count++
@BBI-Brandboost
@BBI-Brandboost 4 года назад
This is great content. We look forward to the next one in the series.
@MadhusudanBhosale
@MadhusudanBhosale 4 года назад
The way you handle errors correction, I just love it. #traversymedia #bradtraversy
@ThiagoVieira91
@ThiagoVieira91 4 года назад
Just in time for a productive lunch break! 🙌🏼
@novailoveyou
@novailoveyou 4 года назад
I would love to see testing! Thanks for your videos Brad!
@nirtzezana627
@nirtzezana627 4 года назад
Keep it up with the Data structures, great!
@CodingWithMrM
@CodingWithMrM 3 года назад
Thanks it's really helpful for me
@ekrempolat7604
@ekrempolat7604 4 года назад
Hi bro. Please stay home and never leave nowadays. Covid-19 and events in US makes ne nervous. I always think what would i do if something happens to you.
@eatplaythink
@eatplaythink 4 года назад
Awesome video... concepts are very clear.
@abelotugeme9671
@abelotugeme9671 4 года назад
Just this week I started doing work on this data structure with JS but I implemented with linked lists. Pushed the code to GitHub today...
@tom.watkins
@tom.watkins 4 года назад
Great video. Only thing I was expecting was the pop method to reduce the size of the internal array
@skandmishra3739
@skandmishra3739 4 года назад
Thanks for your videos. Please make a video on Binary search tree with traversing like BFS and DFS
@MattDuarte11
@MattDuarte11 4 года назад
Oddly enough my last user story I had to use a hash map data structure. I don’t know data structures and was able to do it with the Map object in JS. I need to learn these
@akashnishad8128
@akashnishad8128 2 месяца назад
Good , but one suggestion, you should have deleted actual element from array inside pop function, because after you remove element 'empty slots' will be created inside array
@BleedingDryTheHeart
@BleedingDryTheHeart 4 года назад
This is awesome , thank you Brad
@gottamsnehamary9420
@gottamsnehamary9420 4 года назад
Plz do make full course on data structures in JavaScript either on the channel or on Udemy ..please as a programmer it's very important stuff
@abdikaniahmed2294
@abdikaniahmed2294 4 года назад
Please continue this new playlist for data structure. And I so interest if you add slides for explaining before writing a code as usually you do. thank you so much
@roothacks6864
@roothacks6864 4 года назад
I am very happy sir please make a whole series of it❤❤❤
@smartydude2157
@smartydude2157 4 года назад
That's so awesome 😍 i think Actually my Law of Attraction has worked out.. I was daily searching for great whole algorithm series and finally got it 😊😊😀
@PauloSantos-yu1tn
@PauloSantos-yu1tn 3 года назад
I think there was a problem with .pop(), the pop method is not removing the item, it is reducing the count only, but the item remains in items list, this could lead to a memory leak. I added "this.items.splice(this.count - 1, 1); " to pop method, to really remove the item.
@incognitosco
@incognitosco 4 года назад
This is great Brad especially for interviews ✅
@andrewclarke6916
@andrewclarke6916 4 года назад
Thanks for this, Brad. Really looking forward to this series. It will probably involve you having to explain some concepts with diagrams though, which you're not so keen on doing.
@albertdugba
@albertdugba 4 года назад
awesome Brad. Having really been looking forward to this. Many thanks big bro
@cameronthompson1275
@cameronthompson1275 4 года назад
Awesome! Great start to data structures! Keep up the great work!
@alisiraj2100
@alisiraj2100 4 года назад
Thanx brad, Ur tutorials are amazing
@sardorjumanazarov441
@sardorjumanazarov441 4 года назад
awesome Brad. I like all lessons, pls keep going
@ShubhamSauravYT
@ShubhamSauravYT 4 года назад
Please continue with the series and also make some videos on Go programming language
@Mehedihasan-rahat
@Mehedihasan-rahat 2 месяца назад
Very very smart job thanku❤
@credonduhura7121
@credonduhura7121 4 года назад
Thanks for starting this series Brad!! it's very important stuff to know as a programmer, as you mentionned. Can you please make a udemy course for algorithms and data structures
@ahmedboutaraa8771
@ahmedboutaraa8771 4 года назад
Am was eagerly waiting for more of data structure
@matevzmiskec5388
@matevzmiskec5388 7 месяцев назад
Pop method isn't actually removing anything from the array, you are just returning the element that should be removed.
@alimanzoor2359
@alimanzoor2359 4 года назад
as usual awesome, bro if possible kindly make a video on React + immer
@arjunkashyap8896
@arjunkashyap8896 4 года назад
I know stack and other DS but I'll still watch this series..
@hardwired89
@hardwired89 3 года назад
datastructure content ❤️ from SEA.
@MrGarfield
@MrGarfield 4 года назад
Hmmmz, Correct me if 'M wrong... But pop() is not really removing the content out of this.items. it just decreasing the this.count. If you add a console.log(this.items) to the function pop(), you will always see [ 100, 200, 300 ] reset(){ this.count=this.items.length; } stack.reset(); this will return magically all items ;-)
Далее
Linked List Data Structure | JavaScript
29:36
Просмотров 207 тыс.
JavaScript Higher Order Functions & Arrays
34:56
Просмотров 985 тыс.
Stack Data Structure Tutorial - Solve Coding Challenges
1:56:14
AJAX Crash Course (Vanilla JavaScript)
1:09:43
Просмотров 723 тыс.
JavaScript Data Structures: Getting Started
1:36:47
Просмотров 241 тыс.
JavaScript Array Mastery: Tips, Tricks & Best Practices
1:02:49
The JS Call Stack Explained In 9 Minutes
9:30
Просмотров 87 тыс.