Graph Search Algorithms in 100 Seconds - And Beyond with JS

  Рет қаралды 273,584

Fireship

Fireship

Күн бұрын

Prepare for a technical interview by learning about the graph data structure and basic traversal algorithms like depth-first search (DFS) and breadth-first search (BFS). fireship.io/co...
#compsci #JavaScript #100SecondsOfCode
Install the quiz app 🤓
iOS itunes.apple.c...
Android play.google.co...
Upgrade to Fireship PRO at fireship.io/pro
Use code lORhwXd2 for 25% off your first payment.
My VS Code Theme
Atom One Dark
vscode-icons
Fira Code Font

Пікірлер: 501
@Fireship
@Fireship 4 жыл бұрын
Do you want to see more videos with a technical "interview prep" focus? Usually I cover practical projects, so curious to know what you think...
@sadn1ck
@sadn1ck 4 жыл бұрын
YES please! Much love!
@nicolasferrero9928
@nicolasferrero9928 4 жыл бұрын
I like this videos more than others
@PrakashVl
@PrakashVl 4 жыл бұрын
Yes interview preparation, this one is awesome
@abhinav.sharma
@abhinav.sharma 4 жыл бұрын
YEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
@sagnikpradhan3594
@sagnikpradhan3594 4 жыл бұрын
Yes!
@sagnikpradhan3594
@sagnikpradhan3594 4 жыл бұрын
I would love more algorithms, data structures, and ML too!
@nils42
@nils42 4 жыл бұрын
Thanks, with my 6 years+ experience as a Frontend-dev, I now feel like a junior-dev again 😅
@shygrammer
@shygrammer 4 ай бұрын
you just said it!
@meco
@meco 4 жыл бұрын
I would’ve needed this for my computer science class 😫😫 Once again your content is the high quality learning we all needed
@athulp6591
@athulp6591 4 жыл бұрын
In my case , it is right on time.
@miteshkumar3183
@miteshkumar3183 4 жыл бұрын
This is a basic topic in a first semester computer science class.
@anirudhtv
@anirudhtv 4 жыл бұрын
IF CS WAS A MOVIE THEN THIS MAN YOU WOULD BE THE AUTHOR
@YoloMonstaaa
@YoloMonstaaa 4 жыл бұрын
Movies have script writers and directors as key creative roles. No authors.
@calvinebun-amu5397
@calvinebun-amu5397 4 жыл бұрын
100%
@Fireship
@Fireship 4 жыл бұрын
I'm writing a screenplay titled "CS - The Movie" ;)
@raymondmichael4987
@raymondmichael4987 4 жыл бұрын
Fireship, I'll definitely watch it. Greetings from Tanzania 🇹🇿
@abelkidanemariam6485
@abelkidanemariam6485 4 жыл бұрын
another Ali gate fan here
@aykborstelmann8623
@aykborstelmann8623 4 жыл бұрын
I really appreciate this format especially the combination of 100 seconds & beyond 100 seconds
@Loopmootin
@Loopmootin 4 жыл бұрын
3:25 "go slowly and explain every step!" while going on for 10½ minutes like an absolute rap god xD Had to watch the video back to back twice and still only got half of it, but loved all of it ^^
@ihavetwofaces
@ihavetwofaces 4 жыл бұрын
+1 for the "x in 100 seconds... but wait there's more!" format. Getting a brief overview of the concepts followed immediately by a more in-depth implementation of those concepts is a fantastic way to structure the video.
@sathishshaj7815
@sathishshaj7815 4 жыл бұрын
This video is more than worth of my three year CS degree 🔥
@Pogibakayo
@Pogibakayo 4 жыл бұрын
So glad. While these X in 100 seconds videos are great for some topics, this definitely needed a longer one.
@Fireship
@Fireship 4 жыл бұрын
Thanks! Yeah, trying to decide if I should make them as completely separate vidoes
@Pogibakayo
@Pogibakayo 4 жыл бұрын
Fireship I’d certainly love that! But honestly, anything you put out is gold. You’re on fire.
@Ajay-ku6oq
@Ajay-ku6oq 4 жыл бұрын
@@Fireship Maybe release them simultaneously so that people who want can watch both and there is a higher chance of one going viral.
@Sunwarul
@Sunwarul 4 жыл бұрын
@@Fireship Please make this type of video with a slow pace. Your teaching style is good. but just take longer and bit slower-paced videos. Give some time to grasp the concept along. However, like these videos. Thanks!
@LineageFalcon
@LineageFalcon 4 жыл бұрын
Fireship Yeah, I think u definitively should do that. Some of your viewers want more in-depth information and with a bit more time to consume it. So I think it is a good Idea to do a 100 secs version and a in-depth version. Anyways I really appreciate your work and passion. Thank your for your vids. Have a nice day. :D
@simplyweird6369
@simplyweird6369 4 жыл бұрын
Definitely want Algorithms, Design Patterns and Data Structures 🙏
@099watcher
@099watcher 4 жыл бұрын
That was sweet! Please create a playlist of data structures and algorithms. Great content, keep it up 👍🏻. 🔥🔥🔥
@kinnikuchu
@kinnikuchu 5 ай бұрын
You go way too fast, yet you give an introduction as for newbies.
@Brunoenribeiro
@Brunoenribeiro 3 жыл бұрын
fireship does youtube like no other channel the "basics in 100s + deep dive" format is a blast, man
@MarsTheProgrammer
@MarsTheProgrammer 4 жыл бұрын
For anyone that didn't see how you get the steps at 9:49 it's `DFS found Bangkok ${visited.size} in steps`. Use the visited size.
@golddropper2747
@golddropper2747 Жыл бұрын
Very clear instructions. I only know Python and I completely understood your coding process with Javascript.
@darshangowda309
@darshangowda309 4 жыл бұрын
Wow! This is awesome 🙌 would love to see more of this!
@TheGitGuild
@TheGitGuild 4 жыл бұрын
This is really nice. Also try making the speed 2x and watch it like 3 times if you want to overclock your brain. But it could cost you a few more seconds tho :/
@oladimejiakande9070
@oladimejiakande9070 4 жыл бұрын
😂
@TheNewton
@TheNewton 4 жыл бұрын
5:32 Javascript destructuring in 100 seconds
@eshaan7_
@eshaan7_ 4 жыл бұрын
more like JavaScript de-structuring in 100 milliseconds.
@AiguretDuren
@AiguretDuren 3 жыл бұрын
I really enjoyed working with these data structures and algorithms in JavaScript. I would love to see more of this!
@RTshots
@RTshots 4 жыл бұрын
I didn't know I needed a fireship video about cs theory until I watched one. Plz do more
@lucasoliveira-xs5yh
@lucasoliveira-xs5yh Жыл бұрын
Your channel is sooooooo awesome, congratulations! One question that I have: Is the set used at the DFS function a memoization technique?
@magne6049
@magne6049 2 жыл бұрын
0:26 The notation you used actually indicates it is a bi-directional graph, meaning directions in both ways. An undirected graph would have no arrowheads (since arrows indicate direction), but simply a line.
@magne6049
@magne6049 2 жыл бұрын
@Fireship
@suryasarkar9681
@suryasarkar9681 4 жыл бұрын
More on graphs please. This was one of the best explanations of graph traversal on the internet ❤
@Zeda_
@Zeda_ 4 жыл бұрын
This video is awesome! I love seeing these 100 second videos pop up in my feed, they’re always fantastic. One note though: an adjacency matrix does have very bad space complexity, but part of the reason for that is that it’s making the trade-off for time. It actually is quite time efficient to check specific connections [O(1)], so it just depends on what your program is prioritizing or needs.
@kritikkaushal6305
@kritikkaushal6305 4 жыл бұрын
straight up one of the best channels on yt
@ikezedev
@ikezedev 4 жыл бұрын
It is so nice knowing that you decided to use recursion instead of stack in DFS to show to show it can be down either way. Thanks a lot Jeff 😍
@marshallmurray8050
@marshallmurray8050 4 жыл бұрын
Yes, I would definitely like more videos with technical interview prep focus. I'm probably a ways off of an actual interview, but it's nice to mentally prepare proactively because I'm such a good procrastinator!
@trompowsky12
@trompowsky12 4 жыл бұрын
*Music in **0:00**?*
@emsourcemedia9178
@emsourcemedia9178 4 жыл бұрын
This is by far the best explanation of node.
@akam9919
@akam9919 6 ай бұрын
Got an interview in 5 min. Thx!
@teddified3845
@teddified3845 4 жыл бұрын
This hooked me like crazy. Please do more data science and algorithm videos like this. Loved it!
@daheck81
@daheck81 4 жыл бұрын
100 seconds of different time complexities as in the Big-O-Notation would be awesome. I tend to forget how they work when I haven’t dealt with them in a while (same with Regex) so I think a 100 second reminder would be perfect!
@youssefmuhamad3213
@youssefmuhamad3213 4 жыл бұрын
That was awesome, keep it up with more advanced stuff
@kevnar
@kevnar 2 жыл бұрын
I had to figure all this stuff out on my own when trying to implement A* pathfinding in a game I made. The tutorial I followed used an adjacency matrix. But my game maps were 1000 x 1000. The whole thing crashed when it tried to build the matrix. So I manually went through and converted the graph to a list structure, so only nodes with edges were stored. I guess I could have saved the whole thing to the hard disc instead of keeping the whole graph in memory at run-time, but I learned a lot fixing that problem.
@tygobolink5743
@tygobolink5743 4 жыл бұрын
It feels so bad that you upload this video right now. It's a great video and in explains the problems clear. But for a school assignment I had to Depth First Search a specific list of nodes and links. I did need a couple of hours to figure out how to this works. I nailed it but not as clean as you explained the problem and the solution. Thanks for the great video's you make!
@geo9115
@geo9115 4 жыл бұрын
I wish it didn't take my data structures professor 3 weeks to explain this concept. Thanks for the 100 second rundown!
@Aaronmoreno
@Aaronmoreno 4 жыл бұрын
one of my favorite videos so far!
@bmejia220
@bmejia220 3 жыл бұрын
Wow brilliant tutorial man brilliant lesson thanks so much learning so much here
@jasonlantz3808
@jasonlantz3808 2 жыл бұрын
linear time based on edges... linear space based on nodes... O(n), O(m), respectively...
@optimusdebugger9638
@optimusdebugger9638 4 жыл бұрын
yes please we want to see more videos like this!
@Jaybearno
@Jaybearno Жыл бұрын
Graph theory… the only class I almost straight flunked in college and still shiver thinking about. Maybe it’s easier now with code, but in theory it’s confusing AF
@ttul007
@ttul007 4 жыл бұрын
great video! quick and efficient refresher for stuff i touched 10+ years ago when i did my bachelor's. thanks :)
@joshwasuresh6445
@joshwasuresh6445 2 жыл бұрын
He just solved the most difficult problem in the world 😳...
@Melvin420x12
@Melvin420x12 4 жыл бұрын
This is awesome. Thank you. I love the “beyond the 100 seconds”. Never heard of the Map or Set object. These kind if things make me so excited. Do you make these videos on your own or is there a team behind Fireship?
@tartarus1322
@tartarus1322 4 жыл бұрын
Maps are some of the most beautiful data structures that you’ll ever see. A Map is a hashed data structure, which is some of the most useful shit you’ll ever use. A HashSet (not implemented in JS) is incredibly useful. They’re so useful because of their ability to retrieve a value in O(1) by value. This can find if an element exists in (ideally) O(1) rather than logn which is a binary search.
@Melvin420x12
@Melvin420x12 4 жыл бұрын
Tartarus13 Sounds interesting! Do you have a source where we can learn more about this?
@theshermantanker7043
@theshermantanker7043 2 жыл бұрын
@@tartarus1322 well, that is until you start getting hash collisions, that's when maps start rearing their ugly head
@coolj7086
@coolj7086 2 жыл бұрын
Really nice video! Although using map and set do add a O(logV) factor in the final complexity and, depending on how js handles popping elements from the front of the array, an O(V) factor
@hamidbakhtiari3986
@hamidbakhtiari3986 3 жыл бұрын
i would really like to watch more videos like this
@dnk1312
@dnk1312 4 жыл бұрын
Every time the outro music fades in, I can literally feel that 'i get it now' rush ! Thanks a lot and keep up the outstanding work !!
@danbergelt8969
@danbergelt8969 4 жыл бұрын
Great video. You should totally do a whole series of fundamental CS concepts.
@coordinates_
@coordinates_ 4 жыл бұрын
Can you vlog how you make this quality videos?
@stith_pragya
@stith_pragya Жыл бұрын
Thank You So Much for this wonderful video...🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@nero-kun-here
@nero-kun-here 4 жыл бұрын
Very good quality content! I love it! need more videos like this....
@austinealagi
@austinealagi 4 жыл бұрын
Thanks you so much for this video ❤️ you are a life saver. I will need more of this video.
@luis96xd
@luis96xd 4 жыл бұрын
Whoa, amazing video! 😄 I also liked the "Beyond the 100 seconds" I learned a lot of objects and its functions How we could create a recommendation algorithm using graphs in Javascript? What variables or objects we need to implement? 🤔
@gagahkharismanuary9385
@gagahkharismanuary9385 4 жыл бұрын
Sooo cool dudee!! I really take my notes and learnt from your explained
@aleaallee
@aleaallee 4 жыл бұрын
I'm lucky here in europe most companies interview you about the technologies you are going to use to develop websites/web apps and not algorythms.
@kuchbhi6455
@kuchbhi6455 3 жыл бұрын
Jeff please, we need a DSA course. I feel I'm wasting a lot of time learning DSA topics with other resources. Can you please spend sometime on creating a DSA course. - Nobody ( who loves your work a lot.)
@ritambanerjee3668
@ritambanerjee3668 2 жыл бұрын
TBH BFS actually guarantees a solution (if it exists) and gives you the shortest path (if implemented correctly), so I guess to check if a path exists both BFS and DFS can work but if you want to find the shortest path use BFS.
@CodeMonkeyG2011
@CodeMonkeyG2011 2 жыл бұрын
The format of these videos is brilliant! 100 seconds intro and then, if you want it, some practical implementation.
@deepaligarg7643
@deepaligarg7643 2 жыл бұрын
Very good video. What will be the space complexity for each?
@MCMadk
@MCMadk 4 жыл бұрын
Amazing content. Thanks !
@PraveenKumar-ft2kr
@PraveenKumar-ft2kr 2 жыл бұрын
Amazing one.. WE need more of these :) Bring it on brother ✌
@PsHarneja
@PsHarneja 3 жыл бұрын
Every other channel: Increase the video speed to 1.25. This channel: Decrease the speed to 0.75
@MASTERISHABH
@MASTERISHABH 4 жыл бұрын
Nice! Just one question how DFS was more efficient than BFS for checking route existence? What if Bangkok was the second neighbour in the first node itself? In BFS, it could have been found in 1 go but DFS would first traverse all the nodes from the first neighbour to come back to the second one. This will be true for vice-versa. Also, how to determine when to use DFS and BFS respectively? Suggestions? 🤔🤔
@vectrangle
@vectrangle 4 жыл бұрын
Jeff is wrong when he says DFS is more efficient than BFS here, it happened to be that way in his example but only due to luck. You would usually use BFS for any pathfinding problem because it will find the shortest solution first. In my experience DFS is rarely more efficient but it is often easier to code
@beinyourguard
@beinyourguard 4 жыл бұрын
I sincerely don't think I'll ever be a good developer as you are.
@rauchu5861
@rauchu5861 4 жыл бұрын
what is an API,rest api etc. in 100 secs please in the most clear way.
@sqarcle
@sqarcle 3 жыл бұрын
For faster solution to the airport problem you can use dp and in each node store their children.
@kimimhd123
@kimimhd123 3 жыл бұрын
please, more videos like this
@AdrenalineAkash13
@AdrenalineAkash13 4 жыл бұрын
Greatest explanations i've ever seen on KZbin hats off @fireship
@s.hariharan6958
@s.hariharan6958 5 ай бұрын
you are Saviour of cs students 🙇‍♂🙇‍♂...
@nomtijorti
@nomtijorti 4 жыл бұрын
great content as always!
@davidvideauortega287
@davidvideauortega287 4 жыл бұрын
Hellllll I loved this video. THANK YOU!!! This channel is seriously awesome. One of the best coding channels in the entire internet. ❤
@kristofs8893
@kristofs8893 4 жыл бұрын
You just saved me a ton of time. Thanks for the video. :) Keep it up.
@Endede
@Endede 4 жыл бұрын
For your BFS implementation, I think worst case time complexity ends up as O(E + V^2), because the shift() method is (probably) O(N) for N == length of the array. To achieve O(E +V) A "real" queue implementation is needed, that implements enqueue()/dequeue() in constant time.
@shiblynoman310
@shiblynoman310 4 жыл бұрын
Please keep making more algorithm related videos. :)
@napoleaonbonaparte6005
@napoleaonbonaparte6005 4 жыл бұрын
You forgot to initialize the visited Set with "PHX", since it's the first node of the QUEUE which means it's already visited. Nice video tho.
@hendrickmanenga9213
@hendrickmanenga9213 Жыл бұрын
Some people were really born to teach.Congrats
@nulI_dev
@nulI_dev 4 жыл бұрын
this makes so much more sense than any CS video i've ever watched
@quantumcaffeine
@quantumcaffeine 4 жыл бұрын
Great video, but I'm a bit confused by the DFS example. As written, it looks like it will continue searching after the destination has been found as long as one of the parent nodes has unvisited children. How do you ensure that the algorithm stops immediately after the destination has been found?
@nomiscph
@nomiscph 3 жыл бұрын
In the DFS - i would normally pass start as an array and then pass all destinations to a parent array if they do they have not been part of the visited set and then do that then instead of looping back and forth over a tree your taking a whole layer of “children” every time - if that makes sense?
@tinmank
@tinmank 3 жыл бұрын
Hello, are you planning to continue with this topic? I was wondering how the same algorithm would be with the weight to paths. (instead of the shortest, cheapest path) I know there are other sources explaining but none of them explaining as you do :)
@arjunyonzan8557
@arjunyonzan8557 Жыл бұрын
thank you, will be practising a lot
@akifimran9780
@akifimran9780 2 жыл бұрын
Yes more please
@VigneshDhakshinamoorthy
@VigneshDhakshinamoorthy 3 жыл бұрын
Is it fair to say @1:25 accurately describes all of us right now? Great video by the way, cheers! Keep it coming. DONT STOP! PLS!
@MatteoGauthier
@MatteoGauthier 4 жыл бұрын
Very interesting, I want more vide like this !! 🔥🔥
@tijanisylla1348
@tijanisylla1348 3 жыл бұрын
TypeError: Cannot read property 'push' of undefined
@abhinandankumar4584
@abhinandankumar4584 2 жыл бұрын
Mine too...please help if you found the solution..
@OEThe11
@OEThe11 2 жыл бұрын
In 10 Min, I came out with a better understanding of graphs then I have in the previous attempts (which was a lot). Thanks for making graphs make sense.
@abderrahimanejjar91
@abderrahimanejjar91 3 жыл бұрын
Great video!!!
@ThiagoVieira91
@ThiagoVieira91 4 жыл бұрын
Guess I'll have a new job next month... Lately every interview has questions related to graphs.
@sidheshwartiwari9834
@sidheshwartiwari9834 4 жыл бұрын
This is so interesting to learn about... Lately all I have been doing is writing layout with flex and adding event listeners .. and boii , I hate doing that..
@skaneprime
@skaneprime 4 жыл бұрын
More videos like this please!~
@johnnyx6654
@johnnyx6654 4 жыл бұрын
Not gonna lie, have an interview coming up and this was amazing, thanks so much for sharing the knowledge
@tamasbalint1597
@tamasbalint1597 4 жыл бұрын
Awesome! More videos like this, please. :-)
@rishav.bharti
@rishav.bharti Жыл бұрын
A course on DSA please
@karthikbahaddurgattematha4651
@karthikbahaddurgattematha4651 4 жыл бұрын
Yes...yes...yes....yes.... Amazing!!!!!!!!!!!
@ariunboldoyungerel6649
@ariunboldoyungerel6649 3 жыл бұрын
Please make video explaining dynamic programming please please??
@Sagar_RS
@Sagar_RS 4 жыл бұрын
This is awesome, please keep it going 👍 , need more of these .
@evan_sarantis
@evan_sarantis 4 жыл бұрын
Top Content!
@erifetim
@erifetim 4 жыл бұрын
Can you do vim in 100 seconds? After dabbling with it for several weeks, I still don’t understand how vim (or emacs) are preferred over IDEs by so many.
@gradientO
@gradientO 4 жыл бұрын
Please make more of interview series. It helps us all. tan(q)
Deno in 100 Seconds
2:10
Fireship
Рет қаралды 516 М.
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 9 МЛН
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26
小路飞嫁祸姐姐搞破坏 #路飞#海贼王
00:45
路飞与唐舞桐
Рет қаралды 10 МЛН
How to get rich as a solo software developer - The Ultimate Guide
8:51
Graph Algorithms for Technical Interviews - Full Course
2:12:19
freeCodeCamp.org
Рет қаралды 1,2 МЛН
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
What is THIS in JavaScript? in 100 seconds
6:38
Fireship
Рет қаралды 218 М.
How to NOT Fail a Technical Interview
8:26
Fireship
Рет қаралды 1,4 МЛН
Sorting Algorithms Explained Visually
9:01
Beyond Fireship
Рет қаралды 539 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 379 М.
Tmux in 100 Seconds
3:02
Fireship
Рет қаралды 460 М.
Wake up babe, a dangerous new open-source AI model is here
4:45
Fireship
Рет қаралды 1,2 МЛН
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 9 МЛН