Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

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