Question: PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU allet Town You Lavender Town Cerulian GUY Viridian ty Celadon City Fushesia City Pewter City

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU allet Town

allet Town You Lavender Town Cerulian GUY Viridian ty Celadon City Fushesia City Pewter City Safari Zone Victory Road "Cinnabar Island digo Plateau Team Rocket's Lair Suppose one fine morning, you woke up in the world of Pokemon. Now you decided to become a Pokmon master just like your childhood idol Ash Ketchum. For all the problems, you have to take inputs from a txt file you are allowed to use built in list, dictionary, arraylist and queue. Pallet Town Viridian City You Cerulian City Lavender Town Celadon City Fushcsia City Victory Pewter Road City Safari Zone "T "Cinnabar Island Indigo Plateau Team Rocket's Lair Suppose one fine morning, you woke up in the world of Pokmon. Now you decided to become a Pokmon master just like your childhood idol Ash Ketchum. In order to do so, you have to defeat the gyms/bad guys in the places you walk into in a limited amount of time. Your goal is to get to the Victory Road as quickly as possible. Depth-First Search (DFS) Now, imagine your rival. Gary, who was also sent to the Pokmon world, wants to become Pokmon master before you. He is planning to get to Victory Road using the DFS algorithm. Implement a DFS algorithm to determine the places he needs to visit to get to the victory road! Sample Pseudocode for the DFS implementation: (You are allowed to try different approaches with same or less time complexity, but the outputs must match) visited =[O]'no OfPlaces OrNodes printed = 1 #this will store the graph traversing sequence DFS_VISIT (graph, node) Do visited[int(node)-1] 1 printed.append(node) For each node in in graphnode] If node not visited DFS_VISIT (graph, node) #This part is needed if the graph is disconnected. DFS (graph, endPoint) For each node in in graph If node not visited DFS_VISIT (graph, node) Print "printed" list in a loop till you get the end point #Driver Read data from input.bct and create a graph DFS(graph, '12") Sample Inputs: Same as Task 1 Sample Output: Places: 1 2 3 47 11 12 Sample Inputs: 12 171223242534373 11565 76 768 711 898 10 9 10 10 11 11 12 [Here in the first row, 12 means the number of places In the second row, 17 means the total number of connections

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!