Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
DSA Python - Eventual Safe States | BFS | Reverse Graph + Topo Sort | LC 802 - Part 139 [Hindi]
Play lesson

Data Structures and Algorithms with Python | Free DSA with Python Course - DSA Python - Eventual Safe States | BFS | Reverse Graph + Topo Sort | LC 802 - Part 139 [Hindi]

5.0 (2)
23 learners

What you'll learn

This course includes

  • 73.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Full Transcript

Welcome to Part 139 of Code & Debug’s DSA Python Course 2025! In this video, we solve Leetcode 802 - Find Eventual Safe States using a BFS + Topological Sort (Kahn’s Algorithm) approach. Rather than the typical DFS, we flip the graph and apply Kahn’s algorithm to find terminal safe nodes – the ones that do not lead to any cycle. 🔍 In this video, you’ll learn: ✅ How to reverse a directed graph ✅ Using indegree calculation to find safe nodes ✅ Applying BFS with queue for topological processing ✅ Why we sort the final answer ✅ Full dry run & conceptual clarity ✅ Time & Space Complexity breakdown This method is clean, fast, and a great way to understand how topological sorting helps in cycle detection and terminal node identification. 🔗 Leetcode 802 - Find Eventual Safe States: https://leetcode.com/problems/find-eventual-safe-states/description/ 👉 Refer to the article for better understanding: 🔗 https://codeanddebug.in/blog/find-eventual-safe-states-bfs/ 📄 Full DSA YouTube Playlist (All questions in order): 🔗 https://docs.google.com/spreadsheets/d/1AWE15Fy3wD2iqu2vjK_R7cCiuvSsjYQclcdZmHpF66o/edit?usp=sharing 🚀 Free Master DSA with Python Course: 🔗 https://codeanddebug.in/course/master-dsa-with-leetcode 💡 Self-Paced Advanced DSA Course (Zero to Hero): 🔗 https://codeanddebug.in/course/zero-to-hero-python-dsa 🎯 Don't forget to like, comment, and subscribe for more high-quality content from Code & Debug. Hit the 🔔 bell icon for instant notifications! 🎯 Perfect for: Beginners & intermediate students aiming for placements, internships, and tech interviews! 💬 If you enjoyed this video, don’t forget to Like | Share | Comment and hit the 🔔 bell icon for more updates. #EventualSafeStates #Leetcode802 #KahnsAlgorithm #TopologicalSort #GraphBFS #PythonDSA #CodeAndDebug #Part139 #DSACourse2025 #TerminalNodes #SafeNodes #CycleDetection #ReverseGraph #BFSInGraphs

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere