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 :)
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!
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
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.
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.
Really! You are great teacher in the RUclips 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
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?
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.
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!
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! 💚
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!
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.
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.
Hello Brad.. I have a question. When you’re popping an element from the stack, the element doesn’t actually go out of the ‘items’ array right..? It’s still there. Though you decrement the ‘count’ variable... shouldn’t the element be actually going out of the array..? Do correct me if I’m wrong.
@@mykalimba It does matter - you are using less CPU cycles and so your code will be faster. Time spent will be actually noticeably lower, just test it yourself
Technically not a memory leak, although the array doesn't shrink after pop. Javascript makes it a little harder to create true leaks due to garbage collection. The array size will only ever be as large as the number of successive push items. After pop, those items will still be in memory, but future pushes will overwrite them. The element references aren't actually lost. Just technically not 'efficient' in memory usage. Push 100 items - array size == 100. Pop 100 items - array size ==100. Push 100 more items - array size == 100. Also keep in mind @traversymedia was just trying to demonstrate how a stack works. You could do this just as easily with a straight Array using unshift() and pop()
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
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. :)
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!)
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
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.
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.
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 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.
@@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}`);
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.
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.
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..
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!!
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.!!
This will be a great series I think, About the pop method, the item didn't actually deleted and still occupying memory which may cause some problems if we were stacking big chunks of data, the idea was to not use any array's built-in method to pop the item out of the stack (using pop() or re-assign array.length property), I found this article about Memory Management developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management and it states that there is no manual way to trigger the garbage collector, so maybe all we can do is to use delete operator or assign null to the item and leave it for garbage collector to do its job Regards & waiting for more videos like this
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.
Data structure and Algo is very relevant in competitive programming. Big companies seems to need these skillsets. It makes you overall a better and efficient developer. For me data structure & algo + design patterns + all.i.dont.know.yet makes you write efficient program.
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 😊😊😀
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.
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...........
Thank so much for this. Well explained and totally understandable. I hope you see this but this is kinda a reminder of the promise sir to make this an ongoing series. I look forward to seeing Queue, Binary Search Tree and others. Thanks in anticipation :-)
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 !
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
Thank you, Brad, very clear explanation. I think it's a great topic. In future videos, could you also include examples of some use cases for the structures you cover?
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 :)
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!
Traversy Media love some code wars that would be a nice mix of content! Thanks so much brad!
how the method pop removes element? tbh, I couldn't find out how it works and deletes item
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
great
Really happy that brad started data structure series
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.
im in support with his comment
waiting for the next data structure...good stuff
I support this.
that is the honest truth
support!
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.
I'm taking a data Structures course at school next semester so this is perfect timing!! Thank you!
Really! You are great teacher in the RUclips 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
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?
Same...
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.
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!
I just added this.items[this.count] = undefined
after decrementing the count
Same. 😅 It's a great mistake. We also have to manage the memory in data structure
We want more data structures and algos ! Please Brad !
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! 💚
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!
pop() {
if (this.count === 0) return undefined;
this.count -= 1;
this.items = this.items.slice(0, this.count);
}
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.
Looking forward to the complete series of data structures and algorithms, the way you take the flow of your explanation makes things look very easy.
Something different. That's great, Brad. What a coincidence, I too was working on a data structure tutorial series but with Java language.
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.
Thanks, Brad! Really glad to see your videos about Data Structure! Strongly waiting for the rest videos in this area!
Hello Brad.. I have a question. When you’re popping an element from the stack, the element doesn’t actually go out of the ‘items’ array right..? It’s still there. Though you decrement the ‘count’ variable... shouldn’t the element be actually going out of the array..?
Do correct me if I’m wrong.
The same question I was going to make
Why does it matter? It is _effectively_ removed, from the perspective of whoever is using the API for this class.
@@mykalimba It does matter - you are using less CPU cycles and so your code will be faster. Time spent will be actually noticeably lower, just test it yourself
Technically not a memory leak, although the array doesn't shrink after pop. Javascript makes it a little harder to create true leaks due to garbage collection. The array size will only ever be as large as the number of successive push items. After pop, those items will still be in memory, but future pushes will overwrite them. The element references aren't actually lost. Just technically not 'efficient' in memory usage.
Push 100 items - array size == 100. Pop 100 items - array size ==100. Push 100 more items - array size == 100.
Also keep in mind @traversymedia was just trying to demonstrate how a stack works. You could do this just as easily with a straight Array using unshift() and pop()
The next series will be how to deal with memory leaks
Dude, Im coursing data structures in the collegue now, you have this skill to explain things really good. Keep going. Really great channel.
Every Video this guys posts, I just click "Like" even before I watch. You have great content Man.
Thank you Mr Brad for this.
By the way your course Javascript from the beginning on udemy is gold 👌
Greetings from Morocco 🇲🇦
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
Please keep making these kinda content brad. Your channel is incredible
Awesome!! Really happy that you started data structure series
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. :)
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!)
@@eduriseworld Good luck man, let us all now when you get hired!
(maybe you'll replace Zuckerberg, who knows ;D ?)
@@tomershechner sure
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
Please continue with this series, it is very hard to find information on algorithms and data structures in regards to JavaScript
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.
Thank you so much for this video. I really understood everything. I must say you are a good teacher. Love your content 💓
Great video! Thanks for taking the time to put it together! Looking forward to the others in the series!
I think a new ERA is going to begin for Traversy Media Students and for Brad too :)
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.
Many thanks for creating this content and sharing this knowledge, algorithms, and design patterns are needed out there but no one is teaching them
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..
Why does it matter? It is _effectively_ removed, from the perspective of whoever is using the API for this class.
@@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.
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 😅
Exactly, I am looking for the solution
@@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}`);
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.
nice work Brad very clear to understand
This is great! I always wanted Brad to tackle data structures and algorithms in JS, please continue.
Beautiful!! I’m about to get into this topic, so it’s nice to see my favorite teacher explaining it.
me too Really happy that brad started data structure series I will be right here waiting for Brad
Can' t wait to see more on this series. Great start.
I'm new to this channel recently I joined but it's very nice waiting for more videos I'll support u
Are you a mind reader? This is truly fantastic. Thank you so much Brad!
Great video like always Brad!
In 4:24 instead of those two lines 10 and 11 you could write :
return this.count++
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.
your explanations are very clear and easy to understand. Thank you!
The way you handle errors correction, I just love it.
#traversymedia #bradtraversy
This is great content. We look forward to the next one in the series.
Thanks man! I always enjoy your tutorials
I would love to see testing! Thanks for your videos Brad!
I always feared data structures and algorithms but Brad you just explained really well now I'm loving data structures and algorithms ❤️❤️
Wow please keep releasing these Data Structures & Algorithms videos. I really appreciate it bro
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..
Just in time for a productive lunch break! 🙌🏼
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!!
Thanks! I love these data structures videos
One of the best and simple video on stack... Please Brad do videos on other data structures too. Likr hashtable , tree, dynamic programming
Thanks for the video. Just today got to this topic while learning. It was interesting to know how the mothods structured
Thank you Brad. Looking forward to this new series.
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.!!
Finally 😀 Brad to the world 🌎
Please continue this kind of series
It would be great if you can also explain where they can be useful in real-world applications, please Brad!
awesome Brad. I like all lessons, pls keep going
Happy that you started DS❣️
Am was eagerly waiting for more of data structure
Nice explanation with good examples
Awesome! Great start to data structures! Keep up the great work!
awesome Brad. Having really been looking forward to this. Many thanks big bro
This is great Brad especially for interviews ✅
Wow..... Nice series .Thank you brad.
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!
yes i am stuck in pop method can you please explain the correction in pop method
This will be a great series I think,
About the pop method, the item didn't actually deleted and still occupying memory which may cause some problems if we were stacking big chunks of data,
the idea was to not use any array's built-in method to pop the item out of the stack (using pop() or re-assign array.length property),
I found this article about Memory Management
developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
and it states that there is no manual way to trigger the garbage collector, so maybe all we can do is to use delete operator or assign null to the item and leave it for garbage collector to do its job
Regards & waiting for more videos like this
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.
Thanx brad, Ur tutorials are amazing
Awesome video... concepts are very clear.
I am very happy sir please make a whole series of it❤❤❤
Pop does not really delete it from memory. It only decreases the counter, but in raw data the element is still existing.
Right, the item is still there
This is awesome , thank you Brad
awesome! data structures are important to know about like hash tables, I'm looking forward to more 💯
Data structure and Algo is very relevant in competitive programming. Big companies seems to need these skillsets. It makes you overall a better and efficient developer. For me data structure & algo + design patterns + all.i.dont.know.yet makes you write efficient program.
alexandro disla can all haitians speak French?
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 😊😊😀
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.
Great video. Only thing I was expecting was the pop method to reduce the size of the internal array
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...........
Thank so much for this.
Well explained and totally understandable. I hope you see this but this is kinda a reminder of the promise sir to make this an ongoing series.
I look forward to seeing Queue, Binary Search Tree and others.
Thanks in anticipation :-)
Awesome tutorial, thank you!
Keep it up with the Data structures, great!
In the .pop() method you forgot to modify the items stack
Is there a LIFO, a queue, a buffer, planned?
Thanks it's really helpful for me
datastructure content ❤️ from SEA.
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 !
Is the data structure series out yet? Or you stopped doing them?
awesome as usual! I would totally love it to see more of that!! :D
Very very smart job thanku❤
@Traversy Media Where is the link to full playlist of this course.
Yes, please do a video on proper testing
pop is not removing items from the stack, we just change 'count' pointer hiding the bug and potential memory leakage.
Oh yes! Are you going to use other languages like Python as well in your Data Structures series?
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
Thank you, Brad, very clear explanation. I think it's a great topic. In future videos, could you also include examples of some use cases for the structures you cover?
Hey Brad, any examples of when you would use this data structure?