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