free web page hit counter
🛡️
Copyright Notice: This video is officially sourced and embedded from YouTube. For all copyright inquiries, reports, or removals, please contact YouTube's legal team here.
NeetCode

NeetCode

1,090,000 subscribers

⏱ 👁 376,699 views

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! ❤

— @NeetCode

🐦 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

— @amargul838

🐮 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?

— @sibingeorge1642

💡 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!

— @ektasingh5967

🌲 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 ❤❤❤❤❤

— @AnkitSingh-pq7oo

💡 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.

— @honeybadger24886

💡 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

— @mamun001

Topological Sort Solution - https://youtu.be/6kTZYvNNyps

Dijkstra's Solution - https://youtu.be/EaphyqKU4PQ

“

Thank you

— @МадиЮсупов-ю7ф

0:00 - Intro

0:10 - 1. DFS

“

no one traverses my lair except me

— @sh-oj8ei

2:40 - 2. BFS

4:55 - 3. Union-Find

“

Dijkstra in school??? Noway...😂😂😂

— @shankar7435

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.

— @ramvenkatachalam8153

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.

— @amirnasser7768

Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.

“

Good One.

— @impatientgaming9868

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.cinema9731
@

Does topological sort use dfs or bfs? From explanation it’s describing bfs 😮

@tooovisibletosee
@

I know bfs ,dfs,topo sort dijkasta and uninon find little bit too should i start solving questions ?

@technicalspot1848
@

Because of your content..I feel confident while giving interview...huge respect❤

@heen1211
@

this content is gold, man

@aaen9417
@

We need a video for LeetCode 1319!

@adnanelouadghiri6880
@

i only hear mouth sounds on this video....

@BoRedfearn
@

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)?

@a2xd94
@

shouldn't topological sort be BFS and not DFS? (minor error?)

@IYI_WOLF_IYI
@

time complexity of dfs isn't O(V+E)?

@kotsios1998
@

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?

@amitvyas7905
@

You are the best! Thank you soooo much)

@reginafadeeva7881
@

hello everyone,, lets write some neetcode today.

@ramesh_hegde
@

What about bellman ford's algo? Not so common?

@hpj1992
@

You mention a lot hashset is there any video recommended to learn about that data structure? Most focus on implementation

@daydrivver2074
@

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

@gamerclips8895
@

7:33 isn't topological sort actually identical to BFS?

@krige
@

upload more videos on graphs sir

@pranavsharma7479
@

thank you . and I would like to see your face

@ExamSolutions_et
@

Why isn't Top Sort BFS since it looks like you are doing level order traversal?

@abdoulbarry8111
@

What about Bellman Ford or Floyd Warshall Algo

@edgarcamelo3472
@

Its really helpful that you categorize every problem and made a separate folder

@tahichy9169
@

i think it’s pronounced dye-kstras algorithm btw

@runfunmc64
@

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

@ishandeshpande4843
@

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!

@ChristopherLoverich
@

Why so less subscribers dnt know

@tirupatirao7521
@

Ur playlist is the reason I feel confident with Graph questions. Thanks Man!!

@UnspokenThings
@

Hello, for the generic DFS method, should we use void or returning something?

@huizhao2050
@

One of the best interview preparation channel

@praveenmishra2470
@

Just fyi, the Di in Dijkstra is pronounced like Di in Dice

Thanks for the video

@yang5843
@

Thankyou so much

@hackytech7494
@

Shouldnt topological sort use bfs? Since we would have to print all nodes that are at the same level or depth before going further?

@anonymoussloth6687
@

would highly appreciate if you can solve 636. Exclusive Time of Functions

@harryz7973
@

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)

@juda550
@

It's a remainder that you are doing amazing 😁👍🏻

@mohithadiyal6083
@

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

@Goldenandpug
@

LEGEND!!!

@CEOofTheHood