Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

XLSX DISTANCE LINK : https://drive.google.com/file/d/1NokQS4x5LdQR4DX4hUj-fcfeJc

ID: 3729639 • Letter: X

Question

XLSX DISTANCE LINK: https://drive.google.com/file/d/1NokQS4x5LdQR4DX4hUj-fcfeJcD8RA0G/view?usp=sharing

Longmont Niwot Church Ranch Arvada 61t & Pena Gateway Park Fitzsimons Elitch Gardens Union Stout Station 30 25th & Downin & Welton Colfax 13th Ave 2d Ave Mile High Stadium Auraria West Aurora Mall H Florida liff et 2Evans Englewood Oxford City of Sheridan Littleton Downtown Littleton Mineral EFR The driving distance and air mileage between all of these stations can be found in the following Excel spreadsheet tables RTD_table xlsx (Note: there are various tabs in this file. Also, the driving mileage is not symmetric since there are one way streets.) Treat the Light Rail map as a connected graph Beginning at the Denver Airport and expanding nodes until you reach the Elitch Gardens (a popular Denver Amusement park) station, performm the following searches 1. Breadth First Search

Explanation / Answer

breadth first is generally used in case of trees or graphs. the search stops untill it finds the destination node,otherwise it continues with the other nodes. the main drawback with this algorithm is it takes huge memory.

before solving note down the no of stations between the source and destination we need.i.e 9 nodes including elitch garden and denver airport.

C PROGRAM:

#include<stdio.h>

int n,q=0,z=-1; //initialisation

void bfs(int v); // v wil be the vertices i.e the visiting places.

for(i=1;i<n;i++)

if (a[i] && !visited[i])

//then increment z

++z=i;

if (q<=z)

//then increment f

++f=1;

}

main()

{

int v;

printf("enter the no of vertices");

for(i=1;i<=n;i++)

visited [i] =0;

}

printf(" Enter the starting station:");

scanf("%d", &v);

bfs(v);

printf(" The stations reachable are: ");

for(i=1; i <= n; i++) {

if(visited[i])

printf("%d ", i);

else {

printf(" Bfs is not possible. stations are not reachable");

}

}