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)