# Data Structures Easy to Advanced Course – Full Tutorial from a Google Engineer

Learn and master the most common data structures in this full course from Google engineer William Fiset. This course teaches data structures to beginners using high quality animations to represent the data structures visually.

You will learn how to code various data structures together with simple to follow step-by-step instructions. Every data structure presented will be accompanied by some working source code (in Java) to solidify your understanding.

💻 Code: https://github.com/williamfiset/data-structures

⭐️ Course Contents ⭐️
⌨️ (0:00:00) Abstract data types
⌨️ (0:04:28) Introduction to Big-O
⌨️ (0:17:00) Dynamic and Static Arrays
⌨️ (0:27:40) Dynamic Array Code
⌨️ (0:49:16) Doubly Linked List Code
⌨️ (0:58:26) Stack Introduction
⌨️ (1:09:40) Stack Implementation
⌨️ (1:12:49) Stack Code
⌨️ (1:15:58) Queue Introduction
⌨️ (1:22:03) Queue Implementation
⌨️ (1:27:26) Queue Code
⌨️ (1:31:32) Priority Queue Introduction
⌨️ (1:44:16) Priority Queue Min Heaps and Max Heaps
⌨️ (1:49:55) Priority Queue Inserting Elements
⌨️ (1:59:27) Priority Queue Removing Elements
⌨️ (2:13:00) Priority Queue Code
⌨️ (2:28:26) Union Find Introduction
⌨️ (2:33:57) Union Find Kruskal’s Algorithm
⌨️ (2:40:04) Union Find – Union and Find Operations
⌨️ (2:50:30) Union Find Path Compression
⌨️ (2:56:37) Union Find Code
⌨️ (3:03:54) Binary Search Tree Introduction
⌨️ (3:15:57) Binary Search Tree Insertion
⌨️ (3:21:20) Binary Search Tree Removal
⌨️ (3:34:47) Binary Search Tree Traversals
⌨️ (3:46:17) Binary Search Tree Code
⌨️ (3:59:26) Hash table hash function
⌨️ (4:16:25) Hash table separate chaining
⌨️ (4:24:10) Hash table separate chaining source code
⌨️ (4:35:44) Hash table open addressing
⌨️ (4:46:36) Hash table linear probing
⌨️ (5:00:21) Hash table quadratic probing
⌨️ (5:09:32) Hash table double hashing
⌨️ (5:23:56) Hash table open addressing removing
⌨️ (5:31:02) Hash table open addressing code
⌨️ (5:45:36) Fenwick Tree range queries
⌨️ (5:58:46) Fenwick Tree point updates
⌨️ (6:03:09) Fenwick Tree construction
⌨️ (6:09:21) Fenwick tree source code
⌨️ (6:14:47) Suffix Array introduction
⌨️ (6:17:54) Longest Common Prefix (LCP) array
⌨️ (6:21:07) Suffix array finding unique substrings
⌨️ (6:25:36) Longest common substring problem suffix array
⌨️ (6:37:04) Longest common substring problem suffix array part 2
⌨️ (6:43:41) Longest Repeated Substring suffix array
⌨️ (6:48:13) Balanced binary search tree rotations
⌨️ (6:56:43) AVL tree insertion
⌨️ (7:05:42) AVL tree removals
⌨️ (7:14:12) AVL tree source code
⌨️ (7:30:49) Indexed Priority Queue | Data Structure
⌨️ (7:55:10) Indexed Priority Queue | Data Structure | Source Code

Read hundreds of articles on programming: https://www.freecodecamp.org/news

1. mohsen nasri on June 13, 2021 at 7:22 pm

@@@

2. vinayak aggarwal on June 13, 2021 at 7:22 pm

at 1:14:58 shouldn’t node be inserted and deleted from beginning as its a stack??

3. Alifiya Batterywala on June 13, 2021 at 7:25 pm

7:00

4. Min Htet Paing on June 13, 2021 at 7:26 pm

I would like to suggest to add subtitles. English is not my native language and my listening is also not good enough to understand completely. So, without subtitle , I encounter many difficulties . I really want to learn this full course more precisely. So adding subtitles will make me more easy to learn this course. And I really appreciate freeCodeCamp for making full free courses.

5. Fast Eddy Love-Muffin on June 13, 2021 at 7:27 pm

I was wondering what Emo finally wound up doing…
I totally am kidding of course. Really great video, thanks for posting.

6. Avishkar Waikar on June 13, 2021 at 7:27 pm

Can someone please explain me, where do we implement skip lists in real life!!
I have searched a lot of documents and previous research papers and even the internet doesn’t provide a proper solution!!

7. DANIEL SHTEINBUK on June 13, 2021 at 7:29 pm

r/superstonk
The MOASS is coming
Gme
🔔

8. Hozay on June 13, 2021 at 7:30 pm

Going to watch this for my future courses in the Fall.

9. Samail Quliyev on June 13, 2021 at 7:30 pm

It is time in vain

10. Royal Jai on June 13, 2021 at 7:31 pm

⌨️

11. Data Structures Simplified on June 13, 2021 at 7:32 pm

12. Atharva Bhanage on June 13, 2021 at 7:32 pm

code samaj me nhi aate re isme….dont see

13. Data Analysis With Omar on June 13, 2021 at 7:34 pm

14. Francis Dave Cabanting on June 13, 2021 at 7:34 pm

Progress:

0:27:40

15. Ous Ali on June 13, 2021 at 7:36 pm

Hi do you know the right order for studying data structures courses on this channel?Becuase there are:intro to data structures,data structures and algorithms,data structures from easy to advanced.
And also what about c++ is there any courses in this channel about c++ other than the 4 hours course? Becuase I don’t believe that you can learn an entire programming language in four hours

16. Jerome Browne on June 13, 2021 at 7:36 pm

Is it okay to watch dispute only knowing JavaScript?

17. Tech HackZ on June 13, 2021 at 7:38 pm

if you just started with programming then u might struggle at some places but overall nice tutorial

18. Hexi on June 13, 2021 at 7:38 pm

There is an calculational error at 15:10 (second line from the bottom).

19. Abdi MD on June 13, 2021 at 7:38 pm

Is there any pre-requisite knowledge required before starting this course ?

20. Abhigyan Chattopadhyay on June 13, 2021 at 7:40 pm

Can someone explain the conversion of priority queue from min to max part at 1:45:59? I’m unable to follow what’s going on

21. khadija kumar on June 13, 2021 at 7:42 pm

wooow, this is the best video i have come across on this topic. thanks you

22. Safoora Ranjbaran on June 13, 2021 at 7:43 pm

That was excellent William I’m sure my exam would be very good tomorrow. Many Many thanks

23. Panji on June 13, 2021 at 7:44 pm

Any course teaching graph, traversal, ad dynamic programming?

24. froge on June 13, 2021 at 7:45 pm

58:26 find yourself someone who loves you the way this dude loves stacks 🥰

25. tường Nguyễn on June 13, 2021 at 7:45 pm

It would be great if this video had subs

26. freeCodeCamp.org on June 13, 2021 at 7:47 pm

Click the "JOIN" button below the video to support freeCodeCamp.org!

27. Piyush Sharma on June 13, 2021 at 7:48 pm

Which programming language is he using?

28. Akash Thakur on June 13, 2021 at 7:50 pm

Is it java with ds?

29. mahdi abedian on June 13, 2021 at 7:50 pm

good

30. Joe Kanaan on June 13, 2021 at 7:52 pm

What coding language is this? It’s not java or C or C++ or C# or python

31. Ashish Kalra on June 13, 2021 at 7:52 pm

4:24

32. Chinmaya Bisoi on June 13, 2021 at 7:55 pm

What language he using in this??

33. sana sultana on June 13, 2021 at 7:56 pm

Thank you so much for your videos

34. Tech HackZ on June 13, 2021 at 7:58 pm

priority queue min heap and max heap full code in c++ using pointers and not array representation of the binary tree

#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <stdbool.h>
#include <math.h>
#include <string>
#include <string.h>

using namespace std;

struct node
{
int data;
node* left;
node* right;
node* prev;
};

class max_heap
{
protected:
int first=1;
node* rroot;
node* act;
node* last;
queue<node *> q1;
stack<node *> stack1;
void traverse11(node *ptr , int x=0)
{
if(ptr!=NULL)
{

cout<<ptr->data<<"t"<<x<<endl;
traverse11(ptr->left , 1);
traverse11(ptr->right , 2);
}
}

void check(node *root)
{
cout<<"in check"<<endl;
cout<<"t"<<root->data<<endl;
if(root->prev==NULL)
{
cout<<"NULL trigger"<<endl;
return;
}else
if(root->prev->data<root->data)
{
// int x=root->prev->prev->data;
int y=root->prev->data;
int z=root->data;
cout<<"y: "<<y<<"z: "<<z<<endl;
node *temp1=root->prev->prev;
node *temp2=root->prev;
node *temp3=root;
node *temp2_left=temp2->left;
node *temp2_right=temp2->right;
temp2->data=z;
temp3->data=y;
check(temp2);
}
}

void top_check(node *root)
{
cout<<"in top_check"<<endl;
if(root==NULL )
{
cout<<"in top_ckeck_NULL trigger"<<endl;
return;
}
node *highest;
if(root->right!=NULL){
int x=max(root->left->data , root->right->data);
if(x==root->left->data)
{
highest=root->left;
}else
{
highest=root->right;
}
}else
{
if(root->left!=NULL)
{
highest=root->left;
}else
{
return;
}
}
cout<<"highest:"<<highest->data<<endl;
if(root->data>=highest->data)
{
return ;

}else
{
int temp1=root->data;
root->data=highest->data;
highest->data=temp1;
top_check(highest);
}

}

public:
node * root()
{
return rroot;
}

max_heap( )
{
queue<node *> q2;
q1=q2;
stack<node *> s1;
stack1=s1;
}

void push(int x)
{
node *new1=new node;
new1->data=x;
new1->left=NULL;
new1->right=NULL;
new1->prev=NULL;
if(first==1)
{
rroot=new1;
q1.push(new1);
q1.push(new1);
act=rroot;
last=rroot;
stack1.push(new1);
first++;
}else
{
node *temp1=q1.front();
act=temp1;
stack1.push(new1);
q1.pop();
if(temp1->left==NULL)
{
temp1->left=new1;
new1->prev=temp1;
q1.push(new1);
q1.push(new1);
check(new1);

}else if(temp1->right==NULL)
{
temp1->right=new1;
new1->prev=temp1;
q1.push(new1);
q1.push(new1);
check(new1);
}
}
}

int peek()
{
return rroot->data;
}

void pop()
{

node *last=stack1.top();
act=last->prev;
if(stack1.size()==1)
{
cout<<"rooooooooooooooooot"<<last->data<<endl;
rroot->data=0;
rroot->left=NULL;
rroot->right=NULL;
rroot->prev=NULL;
stack1.pop();
return;
}
cout<<"act"<<act->data<<endl;
stack1.pop();
rroot->data=last->data;
if(act->left->data==last->data)
{
act->left=NULL;
}else
{
cout<<"pop else"<<endl;
act->right=NULL;
}
top_check(rroot);
delete last;
}

vector<int> heap_sort()
{
vector<int> v1;
while(stack1.size()!=0)
{
v1.push_back(peek());
pop();
}
return v1;
}

void traverse()
{
traverse11(rroot);
}

};

class min_heap : public max_heap
{
public:
void push(int x)
{
x=-x;
node *new1=new node;
new1->data=x;
new1->left=NULL;
new1->right=NULL;
new1->prev=NULL;
if(first==1)
{
rroot=new1;
q1.push(new1);
q1.push(new1);
act=rroot;
last=rroot;
stack1.push(new1);
first++;
}else
{
node *temp1=q1.front();
act=temp1;
stack1.push(new1);
q1.pop();
if(temp1->left==NULL)
{
temp1->left=new1;
new1->prev=temp1;
q1.push(new1);
q1.push(new1);
check(new1);

}else if(temp1->right==NULL)
{
temp1->right=new1;
new1->prev=temp1;
q1.push(new1);
q1.push(new1);
check(new1);
}
}
}

int peek()
{
return -(rroot->data);
}

void traverse()
{
traverse11(rroot);
}

void traverse11(node *ptr , int x=0)
{
if(ptr!=NULL)
{

cout<<-(ptr->data)<<"t"<<x<<endl;
traverse11(ptr->left , 1);
traverse11(ptr->right , 2);
}
}

vector<int> heap_sort()
{
vector<int> v1;
while(stack1.size()!=0)
{
int x=peek();
v1.push_back(x);
pop();
}
return v1;
}

};

int main()
{
max_heap mh1;
int t;
int t1=0;
cin>>t;
int data;
while(t–)
{
cout<<"data";
cin>>data;
mh1.push(data);
}
mh1.traverse();
cout<<"pop================"<<endl;
while(t1–){
cout<<"pop================"<<endl;
cout<<"peek============================================"<<mh1.peek()<<endl;

mh1.pop();
mh1.traverse();
cout<<"pop================end"<<endl;
}
mh1.traverse();

cout<<"root:"<<mh1.peek()<<endl;
cout<<"heapsort——————————–"<<endl;
vector<int> ans=mh1.heap_sort();
for(auto& it1:ans)
{
cout<<it1<<"t";
}
cout<<endl;

min_heap mi1;
mi1.push(1);
mi1.push(2);
mi1.push(3);
mi1.push(4);
mi1.push(5);

cout<<"min heap"<<mi1.peek()<<endl;
cout<<"min heap sort"<<endl;
mi1.traverse();
vector<int> ans2=mi1.heap_sort();
for(auto& it1:ans2)
{
cout<<it1<<"t";
}

}

35. GoLang Beginners on June 13, 2021 at 7:58 pm

Nicely explained 🙂

36. mohsen nasri on June 13, 2021 at 7:58 pm

@

37. Aardvark on June 13, 2021 at 8:02 pm

15:57 3n * (40 + n^3/2) = 120*n + 3*n^4/2

38. Me Arman on June 13, 2021 at 8:07 pm

For path compression why is E F @ goes from F TO E instead of the prrvious a to b and c to d this really confuses me also why is it E taht gets designated as well as H WHY NOT SOME OTHER LETTER LIKE A OR B OR ANY OTHER ONES? this is in the union find path compression @ 2:55:13 just confsuing please help

39. Daniel Carrasco Marín on June 13, 2021 at 8:07 pm

I like this videos, but they are too long… Is better to have a lot of smaller videos which are easier to follow.

40. Nikhil Ravulaparthy on June 13, 2021 at 8:08 pm

Just a short note for everyone studying for Coding Interviews or just studying in general; the most imp DS’s are
Arrays
Stacks
Queues
Trees
Graphs and
Hash Tables

41. gloobs on June 13, 2021 at 8:08 pm

Thx i slept while listening to this and i was able to absorb everything in this vid

Edit: i got a 98% mark on the computer science test

42. Robert Hudák on June 13, 2021 at 8:09 pm

How is this free

43. Hugo Ruiz on June 13, 2021 at 8:09 pm

Great Review!

44. Karthick R on June 13, 2021 at 8:10 pm

Can i just learn all this data structure’s concept from this video and then implement it in c or python or should i know java for sure?

45. Madhav Humagain on June 13, 2021 at 8:10 pm

At 2:53:50, probably A, B, C, D, E also point to G after F points to G.

46. Abhishek Ghosh on June 13, 2021 at 8:11 pm

Useless tutorial

47. Marie Drapalova on June 13, 2021 at 8:17 pm

Love the tutorial. Thank you very much. A friendly suggestion: Stay consistent with the operations on data structure. (e.g. Search, Access, Remove etc) and maybe define the meaning. I noticed sometimes you use ‘Search’ but really mean ‘Access’ and it becomes confusing for some of us :).

48. Ehsan Hadid on June 13, 2021 at 8:17 pm

32:22 , there is a bug in function "removeAt", the if statement should be OR instead of AND.

49. Irfan vox on June 13, 2021 at 8:18 pm

2x save you about 4hrs of life 🙂

50. سالم علي سالم on June 13, 2021 at 8:18 pm

30:00