From 1c076b30e8673529b33e5983665314148f32a48c Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Fri, 1 Mar 2019 23:05:52 +0530 Subject: [PATCH] Breadth First Search --- Breadth First Search/BFS.c | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Breadth First Search/BFS.c diff --git a/Breadth First Search/BFS.c b/Breadth First Search/BFS.c new file mode 100644 index 0000000..c454c24 --- /dev/null +++ b/Breadth First Search/BFS.c @@ -0,0 +1,73 @@ +#include +#include +#define MAX 10 + +void bfs(int graph[][MAX],int visit[],int n,int start) +{ + int f=0,r=-1,i; + int q[10],node; + visit[start]=1; + q[++r]=start; + while(f<=r) + { + node=q[f++]; + for(i=0;i