Source code
#include <iostream>
#include<stdlib.h> ///for use rand function on c++
#define size 100
using namespace std;
int f=0,r=0,n;
char q[size + 1];
char visit_array[100];
int len=0;
char vertex[26];
int graph[100][100];
void visit(char ch) ///save the visited node
{
visit_array[len]=ch;
len++;
}
int is_visit(char ch) ///check if the node is already visited or not
{
for(int i=0; i<len; i++)
{
if(ch == visit_array[i])
{
return 1;
}
}
return 0;
}
void enqueue(char ch) /// enqueue function
{
r = (r+1)%(size+1);
q[r] = ch;
}
void print_visit_array() ///print
{
for(int i=0; i<len; i++)
{
cout<<visit_array[i]<<" ";
}
}
char dequeue()/// dequeue function
{
f = (f+1)%(size+1);
char ch = q[f];
q[f] = '