⭐ Shop on Amazon to support me: [ Ссылка ]
⭐ NordVPN to protect your online privacy: [ Ссылка ]
⭐ NordPass to help manage all of your passwords: [ Ссылка ]
In this video, we walk through this well known topological sorting algorithm: [ Ссылка ].
This is a very popular, practical algorithm which could be used in quite a few places.
⭐ Support my channel and connect with me:
[ Ссылка ]
Problem link on LeetCode:
Course Schedule: [ Ссылка ]
Course Schedule II: [ Ссылка ]
Algorithm explained:
we first find a set of vertices that don't have any incoming edges;
then we loop through these vertices to remove any edges using them as incoming vertices;
along the way, if we find other vertices don't have any incoming edges any more, we'll add them into this set as well;
until this set becomes empty, we break out of this loop;
then we check if there are still any edges there, if so, this is a DAG (Directed Acyclic Graph), it's impossible to find such a topological ordering.
Otherwise, return the order.
Time complexity: O(V+E) (V is the number of vertices and E is the number of edges in the given graph)
// TOOLS THAT I USE:
○ Memory Foam Set Keyboard Wrist Rest Pad - [ Ссылка ]
○ Electric Height Adjustable Standing Desk - [ Ссылка ]
○ Apple Magic Keyboard (Wireless, Rechargable) - [ Ссылка ]
○ Apple Magic Trackpad 2 (Wireless, Rechargable) - [ Ссылка ]
○ Apple MacBook Pro - [ Ссылка ]
○ All-In One Printer - [ Ссылка ]
○ Apple AirPods Pro - [ Ссылка ]
○ My new favorite Apple Watch - [ Ссылка ]
// MY FAVORITE BOOKS:
○ Introduction to Algorithms - [ Ссылка ]
○ Designing Data-Intensive Applications - [ Ссылка ]
○ Head First Java - [ Ссылка ]
○ Design Patterns - [ Ссылка ]
Follow me on Github for complete LeetCode solutions: [ Ссылка ]
Support me on Patreon: [ Ссылка ]
My ENTIRE Programming Equipment and Computer Science Bookshelf:
[ Ссылка ]
And make sure you subscribe to my channel!
Your comments/thoughts/questions/advice will be greatly appreciated!
#Kahnsalgorithm #graphsearch #topologicalsorting #softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures
Ещё видео!