Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It's BFS/DFS related problem. Hint : run regular BFS/DFS two times for two nodes and then compare. You must code in python. And before submitting

It's BFS/DFS related problem.

Hint : run regular BFS/DFS two times for two nodes and then compare.

You must code in python. And before submitting please check wether your code provides the correct output or not.

image text in transcribed
Nora has now been taken to "HigherLand" for Level 2 of the competition. Here she discovered that she will be competing with another participant "Lara". Here also there are n warriors in different fixed positions (position 0 through position n-1). Nora is now placed in position 'p' and Lara is placed in position 'q'. Both of them have to kill the warrior Lina in position 'x'. The one who goes to position 'x' first, wins Level 2. For n different positions and m connections (uv) among the positions, your task is to determine who can go to 'x' first -Nora or Lara? Where Nora is in position 'p' and Lara is in position 'q'. If both win, print both. Sample Input 9 /umber of different fixed positions (including Nora's one) 12 /umber of connections 0 1 //position 0 is connected with position 1 02 03 14 N 35 4 8 47 56 67 78 7 //'x'-Lina's position 5 // 'p'-Nora's position 3 // 'q'-Lara's position Sample Output Nora //winner, since Nora can go to 'x' with 2 moves and Lara can go with 3 moves The one who completes Level 2 of "Fight with Brain" will be rewarded with 30 points and a "WildCard" which can be used to bypass the next Level (Level 3) and proceed to Level 4 without losing any point. But if decided to take Level 3 and completed successfully, participant will be rewarded with 30 bonus points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions