Check out a free preview of the full Introduction to Data Structures for Interviews course

The "Types of Data Structures" Lesson is part of the full, Introduction to Data Structures for Interviews course featured in this preview video. Here's what you'd learn in this lesson:

Bianca reviews the types of data structures that commonly show up in interview questions, including Stacks, Queues, Linked Lists, Hash Tables, Arrays & Strings.


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.

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.

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.

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.

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.

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.

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.

So here we have this is like the classic diagram of the JavaScript run time. And we have the stack, the queue and the heap. So the stack is the call stack every time you call a function it gets pushed to a stack. And then we have the queue which is the message queue which is also a piece of the run time that deals with the order that your code executes.

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.

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.

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.

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.

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.

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.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now