From 1eb13d9b7d56d789c0bda200572e748c8a62915d Mon Sep 17 00:00:00 2001 From: Ghada AbdulWahab Date: Sun, 17 Apr 2022 03:33:12 +0200 Subject: [PATCH] update and rename Depth first search algorithm --- .../{Breadth-first search.py => Depth-first-search.py} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename algorithms/Python/searching/{Breadth-first search.py => Depth-first-search.py} (83%) diff --git a/algorithms/Python/searching/Breadth-first search.py b/algorithms/Python/searching/Depth-first-search.py similarity index 83% rename from algorithms/Python/searching/Breadth-first search.py rename to algorithms/Python/searching/Depth-first-search.py index 42fef860..6240e123 100644 --- a/algorithms/Python/searching/Breadth-first search.py +++ b/algorithms/Python/searching/Depth-first-search.py @@ -6,12 +6,12 @@ graph={ 'C':['G','D'], 'S':['G'], } -#function of BFS +#function of DFS def BFS(graph,start,goal): Visited=[] queue=[[start]] while queue: - path=queue.pop(0) + path=queue.pop() node=path[-1] if node in Visited: continue @@ -29,4 +29,4 @@ def BFS(graph,start,goal): Solution=BFS(graph,'S','G') -print('Solution is ',Solution) \ No newline at end of file +print('Solution is ',Solution)