Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You need to start doing your CST370 homework, but you don't really feel like it. You decide to take the longest route from your current

You need to start doing your CST370 homework, but you don't really feel like it. You decide to take the longest route from your current location on campus to where you plan to do your homework to procrastinate a bit. You're given a graph representing CSUMB's campus, and your goal is to nd the path with the most stops to your homework destination without visiting any location more than once.

Input The first line contains your current location. The second line contains the location where you'll do your homework. The remaining input describes a graph where each edge means two locations are adjacent. { The next line contains an integer n, the number of locations on campus. { The next n lines each contain one location. This makes up an array of verticies. { The next line contains two space-separated integers: n e { The next e lines each contain two space-separated integers a and b describing an edge from the vertex indexed at a to the vertex indexed at b. Constraints You can assume the campus locations form a connected, undirected graph. The graph is connected and undirected. Output The length of the longest possible path you can take your current location to your homework destination on a single line.

How do you solve this problem with breadth first search in C++?

Sample Input:

BIT East Campus 9 Pool Library Gym BIT Construction Site Student Center East Campus VPA Building Otter Express 9 22 0 2 0 4 1 3 1 4 2 0 2 8 3 4 3 1 3 8 3 5 4 3 4 1 4 0 5 8 5 3 6 7 7 6 7 8 8 5 8 3 8 2 8 7

Sample Output:

7

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

what is a for AGI deduction? Give three examples.

Answered: 1 week ago