1049 - One Way Roads
Topic: DFS
concept: কস্টকে ডিরেক্টটেড ধরবো তারপর আনডিক্টটেড গ্রাফ এ ডিএফএস চালাবো.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals...
Showing posts with label DFS. Show all posts
Showing posts with label DFS. Show all posts
TOPOSORT - Topological Sorting
TOPOSORT - Topological Sorting
Topic: Topological Sorting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn...
Topological Sorting
Resource Link
Topological Sorting (E-Maxx)
Kahn’s algorithm for Topological Sorting
Topological Sorting
TopSort using DFS:
...
F1. Tree Cutting (Easy Version
F1. Tree Cutting (Easy Version)
Topic: DFS
Concept: প্রতিটা প্যারেন্ট এর চাইল্ড কোন কোন কালার আছে তার হিসাব রাখবো, যেমন প্রথম উদাহরনে -
১ নং নোডের চাইল্ড এর সংখ্যা হবে ১টা লাল, ২টা নীল , ১টা নরমাল।
২ নং নোডের চাইল্ড এর সংখ্যা হবে ১টা লাল, ১টা নীল , ২টা নরমাল।
৩ নং এর ১টা নরমাল (নিজের কালার)।
৪ নং নোডের চাইল্ড এর সংখ্যা হবে ১টা লাল ( এইটা বাদ...
802. Find Eventual Safe States
802. Find Eventual Safe States
Solution: DFS
concept:
যেই নোডগুলোতে সাইকেল নাই ওই গুলা প্রিন্ট করতে হবে।
Code:
class Solution {public: unordered_set<int> cycle_nodes, safe_nodes; bool dfs(vector<vector<int>>& g, int i, unordered_set<int>visited_nodes) ...