Transcript from the "Types of Data Structures" Lesson
>> Bianca Gandolfo: So we're going to talk about data structures now. We're going to go into the theoretical aspects of the data structure. We're going to describe what it looks like the operations you can expect on it. And also the time complexity and analysis of these various operations. So that's step one.
[00:00:25] The analysis, discovery even real life applications, why you would even use this data structure. The next piece is diving into the implementation details and so this would be taking those specific methods that or perform a particular operation on your data structure and writing it such that it beats the specs.
[00:00:50] It solves the problem within the given time complexity requirement of that particular data structure which often means that it relies on something on a particular data structure for storage. In Java script we don't have a lot of data structures that come out of the box especially pre ES6, so pre ES6 we really only had an array or an object as a data structure.
[00:01:19] You know, you can also sort things in variables and you have primitive data types and things like that. But if you wanna store collections. And I mean you could really store. We're gonna do it an exercise where we create an array with string as a store. So you could do that.
[00:01:34] But it's just kind of like a fun exercise. But typically, when you're thinking about storage you're really thinking about an array or an object under the hood. So you have like the core storage of that data structure and then you have those operations that perform on that underlying data structure.
[00:01:58] So then, so that was step two the implementation details. Step three is solving problems with it, right? So actually, using that data structure to solve an interview type question. So we'll do some practice problems together after. And then we'll have like a recap and we'll talk about kind of an overview comparing contrast.
[00:02:22] All of the data structures. All the different operations that we may or may not do with that data structure and think about how we could approach them.
>> Bianca Gandolfo: Cool. So the data structures that we're gonna go over today, we have stacks, queues, linked lists, hash tables, arrays and strings.
[00:03:08] So that's some examples for stack and queue. We have our link list here. Link list is a cool data structure. It's not continuous, right? All these nodes can be anywhere in memory. Then we just have pointers. Link list are important to understand how pointers even work. And that's why a lot of interview questions focus on linked lists to show that you understand how references to data work versus having a data bi-value.
[00:03:41] Then we have hash tables. Hash tables implement a couple cool things. We have a hashing function that we have on our diagram on the top of the screen there. Which it will take some stringified keys and return some integer between a range. That's a hashing function, that's a core component of a hash table.
[00:04:01] Hash tables are used under the hood in. Anytime you're like gosh, I need something in memory. Any time you use an object that's going to be a hash table under the hood. And we have arrays. You know all about arrays already I don't think we need to go there.
[00:04:18] As well as strings you should be using these pretty regularly in your code and be familiar with how they work. You can deal with arrays and strings pretty much interchangeably when you're thinking about interview questions. So when you're asked a string question you could just think about it as an array.
[00:04:38] The difference though a key component and I'll say this again later is that strings are immutable. Which means that you cannot swap characters in a string or anything like that versus an array, right? So if this were an apple if we wanted to swap E and A we could.
[00:04:54] With a string you would have to create a new string with those character swapped. So that's a key difference between a string and array. Otherwise, you can kind of consider them the same. And often, I'll just automatically assume that I'm gonna make a string into an array by splitting it.
>> Bianca Gandolfo: That's what we're gonna talk about today or we're just gonna hop right in.