Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

!!!Please read carefully then answer of this question!!! This Given C programing code is in DFS(Depth First Search). You have to Implement BFS(Breadth First Search)

!!!Please read carefully then answer of this question!!!

This Given C programing code is in DFS(Depth First Search). You have to Implement BFS(Breadth First Search) in the given C programing code. You can't give a new code. You have to edit the code and simply Implement BFS(Breadth First Search) in C program.

You have to answer the question in C program. Any other programming language is not acceptable.

Code -

#include

void dfs(int g[100][100], int visited[], int source, int n);

int main() { int vertex,i,j;

printf("enter number of vertex:"); scanf("%d", &vertex); int arr[100][100], visited[100];

for (i=0; i

}

printf("graph values: ");

for(i=0; i

dfs(arr, visited, 3, vertex); return 0; }

void dfs(int g[][100], int visited[], int source, int n)//n: number of vertices, k: node { int i; visited[source] = 1; printf("%c visited ",65+source); for(i = 0; i< n; i++) { if(g[source][i] == 1 && visited[i] == 0) dfs(g, visited, i, n); } }

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago