Top 5 Most Common Graph Algorithms for Coding Interviews
Video Overview & Insights
🚀 https://neetcode.io/ - A better way to prepare for Coding Interviews
🚀 https://neetcode.io/ - I created a FREE site to make interview prep a lot easier, hope it helps! ❤
🐦 Twitter: https://twitter.com/neetcode1
🥷 Discord: https://discord.gg/ddjKRXPqtk
NeetCode always delivers on graph content.
Visualizing BFS and DFS on the same graph
is the fastest way to understand when you'd
choose one over the other. Made a React
animation showing both — the paths they
take are dramatically different:
https://youtu.be/cYL_hOjac64
🐮 Support the channel: https://www.patreon.com/NEETcode
⭐ BLIND-75 PLAYLIST: https://www.youtube.com/watch?v=KLlXCFG5TnA&list=PLot-Xpze53ldVwtstag2TL4HQhAnC8ATf
Isnt topological sort just bfs?
💡 CODING SOLUTIONS: https://www.youtube.com/playlist?list=PLot-Xpze53leF0FeHz2X0aG3zd0mr1AW_
💡 DYNAMIC PROGRAMMING PLAYLIST: https://www.youtube.com/watch?v=73r3KWiEvyk&list=PLot-Xpze53lcvx_tjrr_m2lgD2NsRHlNO&index=1
Do you even realize how many people you have helped with their interview prep? Seriously, thanks a ton for all your efforts!
🌲 TREE PLAYLIST: https://www.youtube.com/watch?v=OnSn2XEQ4MY&list=PLot-Xpze53ldg4pN6PfzoJY7KsKcxF1jg&index=2
💡 GRAPH PLAYLIST: https://www.youtube.com/watch?v=EgI5nU9etnU&list=PLot-Xpze53ldBT_7QA8NVot219jFNr_GI
Thank you so much for giving the best way to learn graph ❤❤❤❤❤
💡 BACKTRACKING PLAYLIST: https://www.youtube.com/watch?v=pfiQ_PS1g8E&list=PLot-Xpze53lf5C3HSjCnyFghlW0G1HHXo
💡 LINKED LIST PLAYLIST: https://www.youtube.com/watch?v=G0_I-ZF0S38&list=PLot-Xpze53leU0Ec0VkBhnf4npMRFiNcB&index=2
I like how Navneet says "Algo-ithm ", totally eliminating the R, in every single video he makes. Btw great explanation as always.
💡 BINARY SEARCH PLAYLIST: https://www.youtube.com/playlist?list=PLot-Xpze53leNZQd0iINpD-MAhMOMzWvO
Union-Find Solution - https://youtu.be/8f1XPm4WOUc
You are the best leetcoder on YouTube
Topological Sort Solution - https://youtu.be/6kTZYvNNyps
Dijkstra's Solution - https://youtu.be/EaphyqKU4PQ
Thank you
0:00 - Intro
0:10 - 1. DFS
no one traverses my lair except me
2:40 - 2. BFS
4:55 - 3. Union-Find
Dijkstra in school??? Noway...😂😂😂
6:45 - 4. Topological Sort
8:47 - 5. Dijkstra's Algo
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.
12:00 - Extra Graph Algorithms
#common #graph #algorithm
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.
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.
Good One.
More User Perspectives
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
@admirer.of.cinema9731Does topological sort use dfs or bfs? From explanation it’s describing bfs 😮
@tooovisibletoseeI know bfs ,dfs,topo sort dijkasta and uninon find little bit too should i start solving questions ?
@technicalspot1848Because of your content..I feel confident while giving interview...huge respect❤
@heen1211this content is gold, man
@aaen9417We need a video for LeetCode 1319!
@adnanelouadghiri6880i only hear mouth sounds on this video....
@BoRedfearnGreat set of problems! Are the problems sorted in order of importance/frequency encountered (IE DFS most important/frequent, Djikstra's algo least important/frequent)?
@a2xd94shouldn't topological sort be BFS and not DFS? (minor error?)
@IYI_WOLF_IYItime complexity of dfs isn't O(V+E)?
@kotsios1998At 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?
@amitvyas7905You are the best! Thank you soooo much)
@reginafadeeva7881hello everyone,, lets write some neetcode today.
@ramesh_hegdeWhat about bellman ford's algo? Not so common?
@hpj1992You mention a lot hashset is there any video recommended to learn about that data structure? Most focus on implementation
@daydrivver2074The 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
@gamerclips88957:33 isn't topological sort actually identical to BFS?
@krigeupload more videos on graphs sir
@pranavsharma7479thank you . and I would like to see your face
@ExamSolutions_etWhy isn't Top Sort BFS since it looks like you are doing level order traversal?
@abdoulbarry8111What about Bellman Ford or Floyd Warshall Algo
@edgarcamelo3472Its really helpful that you categorize every problem and made a separate folder
@tahichy9169i think it’s pronounced dye-kstras algorithm btw
@runfunmc641) 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
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!
@ChristopherLoverichWhy so less subscribers dnt know
@tirupatirao7521Hello, for the generic DFS method, should we use void or returning something?
@huizhao2050One of the best interview preparation channel
@praveenmishra2470Just fyi, the Di in Dijkstra is pronounced like Di in Dice
Thanks for the video
Thankyou so much
@hackytech7494Shouldnt topological sort use bfs? Since we would have to print all nodes that are at the same level or depth before going further?
@anonymoussloth6687would highly appreciate if you can solve 636. Exclusive Time of Functions
@harryz7973The 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)
@juda550It's a remainder that you are doing amazing 😁👍🏻
@mohithadiyal6083Dude 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
@GoldenandpugLEGEND!!!
@CEOofTheHood