VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Data Structures and Algorithms in JavaScript - Full Course for Beginners

Data Structures and Algorithms in JavaScript - Full Course for Beginners

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn common data structures and algorithms in this tutorial course. You will learn the theory behind them, as well as how to program them in JavaScript. -- Contents (link to code after title) -- -- Stacks (00:21) https://codepen.io/beaucarnes/pen/yMBGbR?editors=0012 -- Sets (09:03) https://codepen.io/beaucarnes/pen/dvGeeq?editors=0012 -- Queues & Priority Queues (19:24) https://codepen.io/beaucarnes/pen/QpaQRG?editors=0012 -- Binary Search Tree (26:03) https://codepen.io/beaucarnes/pen/ryKvEQ?editors=0011 -- Binary Search Tree: Traversal & Height (39:34) https://codepen.io/beaucarnes/pen/ryKvEQ?editors=0011 -- Hash Tables (53:19) https://codepen.io/beaucarnes/pen/VbYGMb?editors=0012 -- Linked List (1:03:04) https://codepen.io/beaucarnes/pen/ybOvBq?editors=0011 -- Trie (1:14:59) https://codepen.io/beaucarnes/pen/mmBNBd?editors=0011 -- Heap (max and min) (1:27:29) https://codepen.io/beaucarnes/pen/JNvENQ?editors=0010 - Heap visualization: https://www.cs.usfca.edu/-galles/visualization/Heap.html -- Graphs: adjacency list, adjacency matrix, incidence matrix (1:42:07) -- Graphs: breadth-first search (1:46:45) https://codepen.io/beaucarnes/pen/XgrXvw?editors=0012 -Data structures article by Beau Carnes: https://medium.freecodecamp.org/10-common-data-structures-explained-with-videos-exercises-aaff6c06fb2b -Follow creator Beau Carnes on
Date: 2022-03-14

Comments and reviews: 10


Great tutorial.
Thank you #freecodecamp and #BeauCarnes for upload this.
Great learning.
Small finding below in Hash Table lesson.
if the storageLimit is 4 and you try to lookup for a value within the same index which was removed, it will throw an error saying -Cannot read property '0' of undefined-.
Adding a check in the lookup function should solve the problem.
Condition that needs to be updated in lookup function.
storage[index][i] && storage[index][i][0] === key
Updated lookup function
this.lookup = function (key) --
const index = hash(key, buckets);-
if (storage[index] === undefined) --
return undefined;-
--
for (let i = 0; i < storage[index].length; i++) --
if (storage[index][i] && storage[index][i][0] === key) --
return storage[index][i][1];-
--
--
-;

reply

I didn't really expected to understand this, but now I finally am able to really understand these concepts! Thank you very much!...
-One important message to all of the people who are trying to understand or having difficulties in understanding this:-
Don't give up, try to clear the basics first, see some videos about Object oriented Programming and practice some functional programming, you'll be able to imagine everything in terms of objects and arrays in javascript, this will help you understand this better! Make sure to watch a few videos and study a few articles before watching this video if you don't understand some of the concepts like BST, LL, etc...Just don't give up!

reply

can anyone explain how this function recursion works in this function, how left function call and right function call inside function works and provide us 1 or 2 for unbalanced and balanced tree.. It will be great help if someone explains as I was not able to understand with explanation on this video. Duration of the content after 46:00
findminheight(node = this.root)-
--
if(node == null)-
--
return -1-
- -
let left = this.findminheight(node.left);-
let right = this.findminheight(node.right);-
if(left < right)-
- -
return left + 1;-
--
else-
--
return right + 1;-
--
-

reply

The difference of sets algorithm only works when the shorter set is passed into the function because you use the first set to check for difference. That-s not proper because in real cases, you don-t know exactly what-s in the sets.
Set1 = [2,3]
Set2 = [3,5,6,7]
In your implementation,
set1.difference(set2) returns [2]
Set2.difference(set1) returns [2,5,6,7]
Shouldn-t you test which set is longer and then use it to check for the difference?
If you implement it that way,
set1.difference(set2) returns [2,5,6,7]
Set2.difference(set1) returns [2,5,6,7]
Foolproof.

reply

Great lesson Mo, A minor correction In BST example though (video at 36:56).... Since BST is always sorted, node -23- can never have a right linking to a lesser value (in this case -19-). In this scenario value -19- should not be there at all. Also, removal of node in BST can be revisited. The replaced value should be the max of the subtree (so 23 can be safely treated as a new node to be replaced in left subtree for your scenario) . Happy Coding!
reply

I have been teaching myself a form of js with google apps script. My question is, why create functions which perform actions like array.shift? Why not just use that method on the array? What is the benefit of doing it this way? In reference to the queue section where he this.dequeue. Or this.size. I can understand for something more like checking for empty. Anyone that can chime in?
reply

please dont use arrays for queues, the shift and unshift operations take O(n) extra time unlike stack's push and pop,
just use a basic linked list, the time complexity will reduce, the only benefit arrays provides is O(1) access but you don't need that incase of stack or queues.

reply

If you're thinking that this knowledge is required to be a developer/programmer you're drastically mistaken. If you don't understand this stuff, the good news is, you need about 1% or less of it to build a web app and get paid for it.
reply

great tutorial man! one comment, the bst delete is missing something. what if the value to replace the 17 is on the left and not the right. we need to recursively search here too?
reply

I'm going through this course and I just can't speak enough of the efforts and quality of these videos. Beau is an amazing instructor!! And thanks again for putting this together.
reply
Add a review, comment






Other channel videos