DSA Python – Topological Sort using Kahn’s Algorithm | GFG Problem | BFS on DAG – Part 136 [Hindi]
2.8K views on YouTube
π Welcome to Part 136 of Code & Debugβs DSA Python Course 2025!
In this session, we explore Kahnβs Algorithm β a powerful BFS-based approach to perform Topological Sorting on Directed Acyclic Graphs (DAGs). This method is often preferred when indegree-based scheduling or layer-wise processing is needed.
π What youβll learn in this video:
β
What is Kahnβs Algorithm and where it’s useful
β
Real-world application of Topological Sort
β
How to calculate indegrees of nodes
β
Step-by-step BFS implementation using a queue
β
Time and space complexity analysis
π‘ This algorithm is particularly important in task scheduling, course prerequisite ordering, and build systems.
π Practice the problem on GFG:
π https://www.geeksforgeeks.org/problems/topological-sort/1
π Refer to the article for better understanding:
π https://codeanddebug.in/blog/topo-sort-kahns-algorithm/
π π Access the full YouTube DSA Playlist Sheet (All Questions in Order):
π https://docs.google.com/spreadsheets/d/1AWE15Fy3wD2iqu2vjK_R7cCiuvSsjYQclcdZmHpF66o/edit?usp=sharing
π Enroll in this FREE DSA Python course here:
π https://codeanddebug.in/course/master-dsa-with-leetcode
π Enroll for Self-Paced Advanced DSA course here:
π https://codeanddebug.in/course/zero-to-hero-python-dsa
π Thank you for supporting Code & Debug!
Donβt forget to like, share, and subscribe, and press the π bell icon to never miss an update.
#TopologicalSort #KahnsAlgorithm #GraphBFS #DSA2025 #PythonDSA #CodeAndDebug #Part136 #GFGProblems #TechInterviews