File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
algorithms/8_depth_first_search Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 22
33![ Overview : Employee hierarchy] ( https://github.com/beladiyadarshan/DFS/blob/main/emp.png?raw=true )
44
5- Given a graph in dictionary form , print all employees reporting to given employee .
5+ Given a graph containing managers and their employees as a dictionary of sets , print all employees reporting to a given manager .
66
77```
88data = {
99 "karan": {"darshan","nikhil"},
1010 "darshan": {"khantil", "tanuj"},
11- ' tanuj' : {"nikhil"},
11+ " tanuj" : {"nikhil"},
1212 "krinish": {"hetul"},
1313 "khantil" : set(),
1414 "nikhil" : set()
@@ -17,21 +17,20 @@ data = {
1717
1818 ```
1919
20- Here, Darshan and Nikhil are reporting to Karan and so on.. .
20+ Example: Darshan and Nikhil are reporting to Karan. Khantil and Tanuj are reporting to Darshan .
2121
2222 ```
23- Q.Find all employees who are reporting to Karan
24- -perform DFS on Karan and print all the employees
23+ Q. Find all employees who are reporting to Karan.
2524 ```
2625
2726** Explanation:**
2827
29- -So here, we want to find all the children of Karan.
28+ -So here, we want to find all the children nodes of Karan.
3029
31- -We will perform DFS on Karan and then traverse all the children of Karan which are unvisited.
30+ -We will perform DFS starting on Karan and then traverse all the children of Karan which are unvisited.
3231
3332** Output:**
3433
3534karan : nikhil darshan tanuj khantil
3635
37- [ Solution] ( https://github.com/beladiyadarshan/DFS/blob/main/DFS_exercise .py )
36+ [ Solution] ( https://github.com/beladiyadarshan/DFS/blob/main/dfs_exercise .py )
You can’t perform that action at this time.
0 commit comments