---
title: '8 DATA STRUCTURES You NEED to Know'
source: 'https://youtube.com/watch?v=SCkbQSPH--A'
video_id: 'SCkbQSPH--A'
date: 2026-08-02
duration_sec: 650
---

# 8 DATA STRUCTURES You NEED to Know

> Source: [8 DATA STRUCTURES You NEED to Know](https://youtube.com/watch?v=SCkbQSPH--A)

## Summary

This video provides a comprehensive overview of eight essential data structures in programming, explaining their underlying mechanics, use cases, and performance implications. It covers arrays, lists, queues, hash sets, dictionaries, linked lists, trees, and graphs, using relatable analogies to clarify complex concepts.

### Key Points

- **Introduction to Data Structures** [00:00] — Data structures are structures for holding data. The simplest form is a variable storing a single value. How you store multiple values affects application performance.
- **Arrays: Fixed Size and Contiguous Memory** [00:46] — Arrays store elements contiguously in memory. You must specify size upfront. Adding or removing items requires finding a new memory block, which is computationally expensive.
- **Lists: Auto-Arrays with Over-Allocation** [02:35] — Lists are over-allocated arrays (usually twice the needed size), reducing memory management overhead. They store references, allowing different data types, but use more memory and are slower for sequential reads.
- **Queues: First In, First Out (FIFO)** [04:11] — Queues operate on a FIFO basis. Items are added to the tail and removed from the head. They are used for scalability, e.g., processing API requests or image manipulations asynchronously.
- **Hash Sets: Unordered and Duplicate-Free** [05:40] — Hash sets store unique values by hashing the data. They do not maintain order. Ideal for avoiding duplicates, but not for ordered data.
- **Dictionaries: Key-Value Pairs** [06:09] — Dictionaries store key-value pairs, hashing the key for lookup. Used in NoSQL databases and memory lookup tables. Hash sets are implemented using hash maps.
- **Linked Lists: Nodes with Pointers** [07:18] — Linked lists consist of nodes, each pointing to the next. No random access; traversal from start to finish. Adding/removing items is constant time, making them suitable for real-time applications.
- **Trees: Hierarchical Relationships** [08:34] — Trees store values with parent-child relationships. Types include binary, binary search, red-black, and AVL trees. Used for hierarchies like file systems or company structures.
- **Graphs: Complex Relationships** [09:37] — Graphs lack a top-down structure; nodes can have multiple relationships, possibly bidirectional. Used for social networks. Implemented using arrays and linked lists.

### Conclusion

Understanding the characteristics and trade-offs of each data structure is crucial for writing efficient code. Choose the right structure based on your data access patterns and performance requirements.

## Transcript

Now, you can get pretty far in programing without understanding data structures, understand how they work, and when to use them. A data structure, as the name implies, is a structure for holding data.
always going to be dealing with data and need to have a way of storing it. The simplest form of a data structure is storing a single value in a variable, to store multiple values and depending on how many values you've got,
how you store them is going to affect the performance of your application. belt that you can use to write better programs. Treating everything like a nail
Different data structures have different uses, and the one that we've already covered in one of my other videos are arrays.
The key thing to remember is that in most programing languages, What I mean by that is that arrays are stored all together
When you create an array, you need to specify how big you want their with the initial elements you want to put into it. This is because the computer needs to find a block of memory large enough
If it can't find a block of memory, big enough to store your array, All of this sort of memory management takes up quite a lot of time and costs you performance in your application.
remove items from an array, even though you can do this and the programing languages make this easy it s going to cost you in performance. The computer needs to find a whole new block of memory for that array to sit in
and then free up the memory that was originally taken up by your array. It can be quite computationally expensive if you're doing a lot of adding and removing When I think about this memory management in my head,
You've got a party of six who want to see a movie. all of your party can sit together. Then a couple of days later your friend says, Oh, I want to see the film too.
Therefore, to be able to fit all seven seats Now the computer is doing exactly the same thing. Arrays are great when you need to iterate through all your items,
either for mathematical operations or for leafing through items in your code. less taxing on the computer when it needs to go from one item to the next.
lots of items in an array, you might be better off with a list. but they do allow you to add or remove items more easily.
Unlike arrays, you don't need to specify how big your list is going to be. To start off with, you can essentially consider a list as an auto-array. You can still store multiple values in it,
In most languages lists as just over allocated arrays. will allocate more memory than it actually needs, usually twice as much.
This means a lot less memory management when you're adding items to your list. Lists tend to store references or pointers to the values that you're using. this means you can store different data types of different sizes in your list.
type. Lists are great but if you're just going to be reading the list sequentially, Unlike an array which can just store the data
a list is going to be reading your values from different parts of memory, A list also takes up a lot more memory than an array does. The next data structure we're going to look at, which are really useful are queues.
Now, queues are a bit like lists in that they use arrays under the hood, but they act a bit differently. Now queues work on a first in first out basis. A bit like queues you have in real life. New items are added to the tail of the queue
Unlike arrays and lists with queues, you can't read stuff Queues are mostly used for scalability reasons or whenever you need to read something in order.
if your computer can't keep up with the number of requests, For example, let's say that you've got an API endpoint Now you have a website that allows a user to upload the photo,
then API then takes the photo, does a few image manipulations, a few filters, and turns into a cartoon and returns it to the user. with the number of requests that it's getting.
This is where queues come in, when the user uploads their photo to the API, you can add the photo to a queue and then a worker can pick up that image add any filters and then return it to the user.
you can just spin out more workers to deal with the queue as data structures in your code if you need to process things in order. So we have covered various ways of storing multiple values in a data structure.
What if when you're adding those values, you want to avoid duplicates in your code? implies, takes a hash of your data and stores the data against that hash. Now, the key difference between a hash set and the other data structures
we've looked at is that a hash set doesn't store things in order. and not the order that you inserted it. Hash sets are perfect when you need to avoid duplicates in your data,
Next up, are dictionaries. to hash sets in that they stop you from having duplicate values in your code. However, unlike hash sets, they work on what we call key-value pairs.
Now, if you think of a real dictionary, you use it to look up a word Now, in this case, the key would be the word that you used to look up and the value would be the meaning.
So dictionaries basically allow you to store a key and look up a different value. Key-value storage like dictionaries have so many different uses in programing. but they're also used in things like NoSQL databases as well.
if you want to have things like memory lookup tables in your code. so when you store something in the dictionary, the key gets hashed, and then it's the hash that is used to look up the value that you're storing.
As you probably guessed, hash sets also use hash maps as well underneath the hood. a hash, of the key, a hash set will store hash of the value. This generally isn't much of an issue
If, however, you find you do need an ordered dictionary Next up, we have linked lists. As the name suggests, linked lists have each item linked to the next one,
Unlike normal lists and arrays, there's no way of accessing a particular item You have to traverse it from start to finish. like they are with arrays instead, each
item has a reference or pointer pointing to the next item in your list. without having to reallocate memory for the entire list. and a lot more predictable in how long they will take.
as all you need to do is change the node on either side of the item if you were going to be adding and removing a lot of items and you want to ensure the time it takes to do that is constant.
for real time applications, where every single millisecond counts. Typically where you're going to be accessing the items in a certain order.
Another way you can use to store data in a structured way are trees. They allow you to store not only the value but also the relationship as well. nodes. It is a bit like a linked list but allows for more than one relationship.
each node can have will generally depend on what type of tree you implementing. general trees can have many children, whereas binary trees can only have two. There are many different types of tree, so there's binary trees, binary
search trees, red black trees, and there's AVL trees as well. that has some form of hierarchy to it. has items with parents and nested children.
This could be stored as a tree as can, like the files and folders on your computer or like a company hierarchy structure. servers, machine learning and search algorithms.
the box tree that you can use. so many different ways to implement a tree that it is very use case specific. Finally the last data structure we're going to look at are graphs. Now
this sort of relationship that trees do, but they lack that top down structure. Now, if a tree is like a family tree, the graph is more like a social network. can have more than one relationship and that relationship can go both ways.
will use a graph to store the relationship between its users. If you find in your data that each node is related to multiple other nodes, like trees, programming, languages don't come with graphs generally built in.
generally using things like an array and linked lists to do that. These are the main data structures that you're going to be using in your code. and see which one would be most applicable to what you're building.
Thank you for watching and I'll see you in the next one.
