Top 5 Most Common Graph Algorithms for Coding Interviews

  Рет қаралды 207,171

NeetCode

NeetCode

Күн бұрын

🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🐦 Twitter: / neetcode1
🥷 Discord: / discord
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 CODING SOLUTIONS: • Coding Interview Solut...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
🌲 TREE PLAYLIST: • Invert Binary Tree - D...
💡 GRAPH PLAYLIST: • Course Schedule - Grap...
💡 BACKTRACKING PLAYLIST: • Word Search - Backtrac...
💡 LINKED LIST PLAYLIST: • Reverse Linked List - ...
💡 BINARY SEARCH PLAYLIST: • Binary Search
Union-Find Solution - • Number of Connected Co...
Topological Sort Solution - • Alien Dictionary - Top...
Dijkstra's Solution - • Network Delay Time - D...
0:00 - Intro
0:10 - 1. DFS
2:40 - 2. BFS
4:55 - 3. Union-Find
6:45 - 4. Topological Sort
8:47 - 5. Dijkstra's Algo
12:00 - Extra Graph Algorithms
#common #graph #algorithm
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.

Пікірлер: 68
@NeetCode
@NeetCode 2 жыл бұрын
🚀 neetcode.io/ - I created a FREE site to make interview prep a lot easier, hope it helps! ❤
@DennisWanyonyi
@DennisWanyonyi 2 жыл бұрын
Unfortunately VMv4 doesn't work when redeemed as a coupon
@eyekenspel1765
@eyekenspel1765 2 жыл бұрын
@@DennisWanyonyi qqqqqq++q++qqqqq+qqq++qqqqq+++qqqqqqqqqqqqqqqqq11q+qq
@eyekenspel1765
@eyekenspel1765 2 жыл бұрын
@@DennisWanyonyi q+qqqqqq++++q+qqq+q+qq+++qqqqqq1q++q+qqqqq+++++++++++++++
@ishandeshpande4843
@ishandeshpande4843 2 жыл бұрын
1) DFS 2) BFS 3) Union Find 4) Topological Sort 5) Dijkstra's Algorithm Bonus (Not as frequently asked)- 1) Prim's/Kruskal's Algorithm (MST) 2) Floyd Warshall's Algorithm
@shreddingstuff
@shreddingstuff 2 жыл бұрын
Dude I sincerely can't thank you enough. I'm studying for job interviews and your content is the only reason I feel semi-confident going into them
@jay-rathod-01
@jay-rathod-01 2 жыл бұрын
semi confident lmfao.btw ALL THE BEST.
@reeshikasingh5615
@reeshikasingh5615 2 жыл бұрын
Lol I feel you, thank you @NeetCode
@arpielen
@arpielen 2 жыл бұрын
I make these words my own.
@dragoshtoader6062
@dragoshtoader6062 Жыл бұрын
Did you get the interview?
@UnspokenThings
@UnspokenThings 2 жыл бұрын
Ur playlist is the reason I feel confident with Graph questions. Thanks Man!!
@technicalspot1848
@technicalspot1848 11 ай бұрын
Hey i know bfs ,dfs topo,dijkstra but don't know Floyd warshall prim kruksal right now should i could follow neetcode graph playlists i am tired of just learning new algos i want to solve question to particular these algos after solving some questions i will move to others algos could you guide ?
@juda550
@juda550 2 жыл бұрын
The time complexity of graph traversals is actually O(V + E), where V is the number of nodes, and E is the number of edges. Graph traversals are only (n) when the graph is a tree with a fixed amount of children(like a binary tree)
@anonymoussloth6687
@anonymoussloth6687 2 жыл бұрын
Can u explain how it is V+E in detail?
@juda550
@juda550 2 жыл бұрын
@@anonymoussloth6687 Hey sorry for responding kind of late, but think of the graph as an adjacency list/hash-map. If you want to traverse the entire graph, you need to traverse each key(vertex) and every value (edge). Therefore, the time complexity is O(V + E)
@simonchristian160
@simonchristian160 2 жыл бұрын
JUDA FROM CSCAREERSDEV?
@juda550
@juda550 2 жыл бұрын
@@simonchristian160 yessir
@amirnasser7768
@amirnasser7768 5 ай бұрын
Thanks for the informative videos. Just a small correction about the time complexity of DFS and BFS: it is not O(V) where V is the number of nodes, but O(V+E), where you should consider the edges as well.
@mohithadiyal6083
@mohithadiyal6083 2 жыл бұрын
It's a remainder that you are doing amazing 😁👍🏻
@tahichy9169
@tahichy9169 2 жыл бұрын
Its really helpful that you categorize every problem and made a separate folder
@runfunmc64
@runfunmc64 2 жыл бұрын
i think it’s pronounced dye-kstras algorithm btw
@MundoTecChannel
@MundoTecChannel Жыл бұрын
🤓☝️
@rohitkumar-el9vi
@rohitkumar-el9vi 5 ай бұрын
Witcher 3 also has a character named dijkstra.
@gnes04
@gnes04 4 ай бұрын
Dyke straw lol
@reginafadeeva7881
@reginafadeeva7881 Жыл бұрын
You are the best! Thank you soooo much)
@heen1211
@heen1211 11 ай бұрын
Because of your content..I feel confident while giving interview...huge respect❤
@zifanxu522
@zifanxu522 2 жыл бұрын
Nice topic! Thanks
@a2xd94
@a2xd94 Жыл бұрын
Great set of problems! Are the problems sorted in order of importance/frequency encountered (IE DFS most important/frequent, Djikstra's algo least important/frequent)?
@aaen9417
@aaen9417 Жыл бұрын
this content is gold, man
@ramvenkatachalam8153
@ramvenkatachalam8153 Ай бұрын
Only bez of Ur playlist is the reason i think i will get a good job . absolutely wonderful videos on DSA . I lov u bro.
@ChristopherLoverich
@ChristopherLoverich 2 жыл бұрын
Topological sort is IMHO less obscure than Union Find or Dijsktra's. The latter are more well known by name because they are illustrative for didactics, e.g. Union Find is the first major algorithm introduced in Sedgewick's book as a case study, before returning to a more orderly review of algorithms. Topological sort is, conversely, is an extenstion to a wide variety of well known practical problems like ordering a course schedule or execution of project or (automated) job dependencies. Cracking the Code Interview even argues you should be able to derive it on the spot if you didn't know it (I disagree but shrug). Its a minor point but I think people might see it and think they should study it last, where as IMHO its more expected knowledge than Dijkstra's and also really easy to understand once you've done a few DFS problems!
@keemkorn
@keemkorn Жыл бұрын
damn bro you really are just talkin. Power to u brudder
@gamerclips8895
@gamerclips8895 2 жыл бұрын
The algorithms were created for optimizing software, deliver efficient solutions, but nowadays most of the companies use them to filter out candidates in job interviews and look cool🤦🏽‍♀️, once you get into the company you probably are not going to hear about that never again
@GabrielAgoncillo-vn9qe
@GabrielAgoncillo-vn9qe 9 ай бұрын
This is 100% correct.
@praveenmishra2470
@praveenmishra2470 2 жыл бұрын
One of the best interview preparation channel
@daydrivver2074
@daydrivver2074 2 жыл бұрын
You mention a lot hashset is there any video recommended to learn about that data structure? Most focus on implementation
@yang5843
@yang5843 2 жыл бұрын
Just fyi, the Di in Dijkstra is pronounced like Di in Dice Thanks for the video
@CST1992
@CST1992 3 ай бұрын
Witcher 3 players would know
@anonymoussloth6687
@anonymoussloth6687 2 жыл бұрын
Shouldnt topological sort use bfs? Since we would have to print all nodes that are at the same level or depth before going further?
@NeetCode
@NeetCode 2 жыл бұрын
Yeah you're right, I think most people do bfs, but I usually do it dfs which is more simple imo (I used dfs for the alien dictionary problem)
@edgarcamelo3472
@edgarcamelo3472 2 жыл бұрын
What about Bellman Ford or Floyd Warshall Algo
@harryz7973
@harryz7973 2 жыл бұрын
would highly appreciate if you can solve 636. Exclusive Time of Functions
@technicalspot1848
@technicalspot1848 11 ай бұрын
I know bfs ,dfs,topo sort dijkasta and uninon find little bit too should i start solving questions ?
@CEOofTheHood
@CEOofTheHood 2 жыл бұрын
LEGEND!!!
@hackytech7494
@hackytech7494 2 жыл бұрын
Thankyou so much
@krige
@krige 2 жыл бұрын
7:33 isn't topological sort actually identical to BFS?
@kyriakoskourkoulis1159
@kyriakoskourkoulis1159 Жыл бұрын
Yeah that's what I think as well🤔
@fsouza
@fsouza Жыл бұрын
In that case yes, but because he picked a bad example.
@technicalspot1848
@technicalspot1848 11 ай бұрын
Topo could be extended by both dfs and bfs(also called as khan's algo)
@adnanelouadghiri6880
@adnanelouadghiri6880 Жыл бұрын
We need a video for LeetCode 1319!
@huizhao2050
@huizhao2050 2 жыл бұрын
Hello, for the generic DFS method, should we use void or returning something?
@abdoulbarry8111
@abdoulbarry8111 2 жыл бұрын
Why isn't Top Sort BFS since it looks like you are doing level order traversal?
@SteversIO
@SteversIO 16 күн бұрын
BFS + topological sort is more complex but feels more intuitive (to me). There's more code as you need to manage "in degrees" (the number of incoming edges to a node) and you need a queue (common in BFS).
@kotsios1998
@kotsios1998 Жыл бұрын
time complexity of dfs isn't O(V+E)?
@pranavsharma7479
@pranavsharma7479 2 жыл бұрын
upload more videos on graphs sir
@hpj1992
@hpj1992 Жыл бұрын
What about bellman ford's algo? Not so common?
@amitvyas7905
@amitvyas7905 Жыл бұрын
At 5:22 you say "which is how I was taught" so could you let us know who taught you and how you started to come up with these approaches to solve all these problems?
@impatientgaming9868
@impatientgaming9868 6 ай бұрын
Good One.
@admirer.of.cinema9731
@admirer.of.cinema9731 8 ай бұрын
Hi can any one help me here, I used to be python coder but got laid off in April and now I want to switch into more development side I am doing dsa only for sometime what other skill should i focus on
@ramesh_hegde
@ramesh_hegde Жыл бұрын
hello everyone,, lets write some neetcode today.
@tooovisibletosee
@tooovisibletosee 11 ай бұрын
Does topological sort use dfs or bfs? From explanation it’s describing bfs 😮
@tooovisibletosee
@tooovisibletosee 11 ай бұрын
@neetcode
@neilmehra_
@neilmehra_ 3 ай бұрын
You can implement topo sort either way, doesn't really matter. Either use BFS, "remove" edges by subtracting indegrees on vertices and add when indeg[u] = 0, or just build the DFS tree.
@tirupatirao7521
@tirupatirao7521 2 жыл бұрын
Why so less subscribers dnt know
@IYI_WOLF_IYI
@IYI_WOLF_IYI Жыл бұрын
shouldn't topological sort be BFS and not DFS? (minor error?)
@neilmehra_
@neilmehra_ 3 ай бұрын
You can implement topo sort either way, doesn't really matter. Either use BFS, "remove" edges by subtracting indegrees on vertices and add when indeg[u] = 0, or just build the DFS tree.
@ExamSolutions.e
@ExamSolutions.e 2 жыл бұрын
thank you . and I would like to see your face
@BBRR442
@BBRR442 Жыл бұрын
i only hear mouth sounds on this video....
Course Schedule - Graph Adjacency List - Leetcode 207
15:47
NeetCode
Рет қаралды 309 М.
Top 8 Data Structures for Coding Interviews
14:00
NeetCode
Рет қаралды 147 М.
Which one is the best? #katebrush #shorts
00:12
Kate Brush
Рет қаралды 27 МЛН
⬅️🤔➡️
00:31
Celine Dept
Рет қаралды 47 МЛН
PINK STEERING STEERING CAR
00:31
Levsob
Рет қаралды 23 МЛН
How Dijkstra's Algorithm Works
8:31
Spanning Tree
Рет қаралды 1,3 МЛН
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 195 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 795 М.
I quit Amazon after two months
10:09
NeetCode
Рет қаралды 573 М.
Top 5 Coding Interview MISTAKES (from a Google Engineer)
8:03
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 1,8 МЛН
Graph Algorithms for Technical Interviews - Full Course
2:12:19
freeCodeCamp.org
Рет қаралды 1,2 МЛН
Software engineer interns on their first day be like...
2:21
Frying Pan
Рет қаралды 13 МЛН
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 27 МЛН
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 50 МЛН
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 7 МЛН
Телефон в воде 🤯
0:28
FATA MORGANA
Рет қаралды 1,2 МЛН
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 831 М.
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 3,8 МЛН