SlideShare a Scribd company logo
Write a BFS algorithm using only arrays and no other data structure.
Solution
#include
#include
#include //For boolean
char que[20];
int front=0, rear=0, n;
char arr[20];
int bfs(int );
char ajMat[20][20];
char b[20];
void display();
int p=0;
int main()
{
char v;
int i, j;
printf("Enter the number of nodes in a graph");
scanf("%d",&n);
printf("Enter the value of node of graph");
for( i=0; i

More Related Content

More from info785431

Write a JAVA LinkedListRec class that has the following methods siz.pdf
Write a JAVA LinkedListRec class that has the following methods siz.pdfWrite a JAVA LinkedListRec class that has the following methods siz.pdf
Write a JAVA LinkedListRec class that has the following methods siz.pdf
info785431
 
Why has one prominent textbook author described IO management as the.pdf
Why has one prominent textbook author described IO management as the.pdfWhy has one prominent textbook author described IO management as the.pdf
Why has one prominent textbook author described IO management as the.pdf
info785431
 
which is true of the data shown in the histogram Which is true of th.pdf
which is true of the data shown in the histogram Which is true of th.pdfwhich is true of the data shown in the histogram Which is true of th.pdf
which is true of the data shown in the histogram Which is true of th.pdf
info785431
 
What is the value of studying humanities in a business or technical .pdf
What is the value of studying humanities in a business or technical .pdfWhat is the value of studying humanities in a business or technical .pdf
What is the value of studying humanities in a business or technical .pdf
info785431
 
What are the two components of dynamic pressureVelocity and densi.pdf
What are the two components of dynamic pressureVelocity and densi.pdfWhat are the two components of dynamic pressureVelocity and densi.pdf
What are the two components of dynamic pressureVelocity and densi.pdf
info785431
 
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
USING JAVAImplement the quicksort optimization median-of-three, i.pdfUSING JAVAImplement the quicksort optimization median-of-three, i.pdf
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
info785431
 
There are 40 students in our class. How many ways they can be lined .pdf
There are 40 students in our class. How many ways they can be lined .pdfThere are 40 students in our class. How many ways they can be lined .pdf
There are 40 students in our class. How many ways they can be lined .pdf
info785431
 
The Task For this assignment you will write a rudimentary text edi.pdf
The Task For this assignment you will write a rudimentary text edi.pdfThe Task For this assignment you will write a rudimentary text edi.pdf
The Task For this assignment you will write a rudimentary text edi.pdf
info785431
 
The SIP handles what functionsA.) establishes a call through the .pdf
The SIP handles what functionsA.) establishes a call through the .pdfThe SIP handles what functionsA.) establishes a call through the .pdf
The SIP handles what functionsA.) establishes a call through the .pdf
info785431
 
The NBA decides to look into the use of meldonium in the league foll.pdf
The NBA decides to look into the use of meldonium in the league foll.pdfThe NBA decides to look into the use of meldonium in the league foll.pdf
The NBA decides to look into the use of meldonium in the league foll.pdf
info785431
 
The organelle that serves as the digestive system in the cell is the .pdf
The organelle that serves as the digestive system in the cell is the .pdfThe organelle that serves as the digestive system in the cell is the .pdf
The organelle that serves as the digestive system in the cell is the .pdf
info785431
 
The major type of interactive forces between molecules of NH_3 are .pdf
The major type of interactive forces between molecules of NH_3 are  .pdfThe major type of interactive forces between molecules of NH_3 are  .pdf
The major type of interactive forces between molecules of NH_3 are .pdf
info785431
 
The group of taxa that have fully developed appendages can be best de.pdf
The group of taxa that have fully developed appendages can be best de.pdfThe group of taxa that have fully developed appendages can be best de.pdf
The group of taxa that have fully developed appendages can be best de.pdf
info785431
 
The Law of Independent Assortment states thatA. Two different gene.pdf
The Law of Independent Assortment states thatA. Two different gene.pdfThe Law of Independent Assortment states thatA. Two different gene.pdf
The Law of Independent Assortment states thatA. Two different gene.pdf
info785431
 
The following results were obtained in the patient from Case Study 25.pdf
The following results were obtained in the patient from Case Study 25.pdfThe following results were obtained in the patient from Case Study 25.pdf
The following results were obtained in the patient from Case Study 25.pdf
info785431
 
Security National Bank is quoting 1-year certificates of deposit wit.pdf
Security National Bank is quoting 1-year certificates of deposit wit.pdfSecurity National Bank is quoting 1-year certificates of deposit wit.pdf
Security National Bank is quoting 1-year certificates of deposit wit.pdf
info785431
 
Recently, the stock market took big swings up and down. A survey .pdf
Recently, the stock market took big swings up and down. A survey .pdfRecently, the stock market took big swings up and down. A survey .pdf
Recently, the stock market took big swings up and down. A survey .pdf
info785431
 
Profit is the difference betweena. the assets purchased with cash.pdf
Profit is the difference betweena. the assets purchased with cash.pdfProfit is the difference betweena. the assets purchased with cash.pdf
Profit is the difference betweena. the assets purchased with cash.pdf
info785431
 
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdfProblem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
info785431
 
Please help with this genetics problems The intermediates that build.pdf
Please help with this genetics problems The intermediates that build.pdfPlease help with this genetics problems The intermediates that build.pdf
Please help with this genetics problems The intermediates that build.pdf
info785431
 

More from info785431 (20)

Write a JAVA LinkedListRec class that has the following methods siz.pdf
Write a JAVA LinkedListRec class that has the following methods siz.pdfWrite a JAVA LinkedListRec class that has the following methods siz.pdf
Write a JAVA LinkedListRec class that has the following methods siz.pdf
 
Why has one prominent textbook author described IO management as the.pdf
Why has one prominent textbook author described IO management as the.pdfWhy has one prominent textbook author described IO management as the.pdf
Why has one prominent textbook author described IO management as the.pdf
 
which is true of the data shown in the histogram Which is true of th.pdf
which is true of the data shown in the histogram Which is true of th.pdfwhich is true of the data shown in the histogram Which is true of th.pdf
which is true of the data shown in the histogram Which is true of th.pdf
 
What is the value of studying humanities in a business or technical .pdf
What is the value of studying humanities in a business or technical .pdfWhat is the value of studying humanities in a business or technical .pdf
What is the value of studying humanities in a business or technical .pdf
 
What are the two components of dynamic pressureVelocity and densi.pdf
What are the two components of dynamic pressureVelocity and densi.pdfWhat are the two components of dynamic pressureVelocity and densi.pdf
What are the two components of dynamic pressureVelocity and densi.pdf
 
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
USING JAVAImplement the quicksort optimization median-of-three, i.pdfUSING JAVAImplement the quicksort optimization median-of-three, i.pdf
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
 
There are 40 students in our class. How many ways they can be lined .pdf
There are 40 students in our class. How many ways they can be lined .pdfThere are 40 students in our class. How many ways they can be lined .pdf
There are 40 students in our class. How many ways they can be lined .pdf
 
The Task For this assignment you will write a rudimentary text edi.pdf
The Task For this assignment you will write a rudimentary text edi.pdfThe Task For this assignment you will write a rudimentary text edi.pdf
The Task For this assignment you will write a rudimentary text edi.pdf
 
The SIP handles what functionsA.) establishes a call through the .pdf
The SIP handles what functionsA.) establishes a call through the .pdfThe SIP handles what functionsA.) establishes a call through the .pdf
The SIP handles what functionsA.) establishes a call through the .pdf
 
The NBA decides to look into the use of meldonium in the league foll.pdf
The NBA decides to look into the use of meldonium in the league foll.pdfThe NBA decides to look into the use of meldonium in the league foll.pdf
The NBA decides to look into the use of meldonium in the league foll.pdf
 
The organelle that serves as the digestive system in the cell is the .pdf
The organelle that serves as the digestive system in the cell is the .pdfThe organelle that serves as the digestive system in the cell is the .pdf
The organelle that serves as the digestive system in the cell is the .pdf
 
The major type of interactive forces between molecules of NH_3 are .pdf
The major type of interactive forces between molecules of NH_3 are  .pdfThe major type of interactive forces between molecules of NH_3 are  .pdf
The major type of interactive forces between molecules of NH_3 are .pdf
 
The group of taxa that have fully developed appendages can be best de.pdf
The group of taxa that have fully developed appendages can be best de.pdfThe group of taxa that have fully developed appendages can be best de.pdf
The group of taxa that have fully developed appendages can be best de.pdf
 
The Law of Independent Assortment states thatA. Two different gene.pdf
The Law of Independent Assortment states thatA. Two different gene.pdfThe Law of Independent Assortment states thatA. Two different gene.pdf
The Law of Independent Assortment states thatA. Two different gene.pdf
 
The following results were obtained in the patient from Case Study 25.pdf
The following results were obtained in the patient from Case Study 25.pdfThe following results were obtained in the patient from Case Study 25.pdf
The following results were obtained in the patient from Case Study 25.pdf
 
Security National Bank is quoting 1-year certificates of deposit wit.pdf
Security National Bank is quoting 1-year certificates of deposit wit.pdfSecurity National Bank is quoting 1-year certificates of deposit wit.pdf
Security National Bank is quoting 1-year certificates of deposit wit.pdf
 
Recently, the stock market took big swings up and down. A survey .pdf
Recently, the stock market took big swings up and down. A survey .pdfRecently, the stock market took big swings up and down. A survey .pdf
Recently, the stock market took big swings up and down. A survey .pdf
 
Profit is the difference betweena. the assets purchased with cash.pdf
Profit is the difference betweena. the assets purchased with cash.pdfProfit is the difference betweena. the assets purchased with cash.pdf
Profit is the difference betweena. the assets purchased with cash.pdf
 
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdfProblem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
Problem 4.7. Tuberculosis is a rare disease in developing countries. .pdf
 
Please help with this genetics problems The intermediates that build.pdf
Please help with this genetics problems The intermediates that build.pdfPlease help with this genetics problems The intermediates that build.pdf
Please help with this genetics problems The intermediates that build.pdf
 

Recently uploaded

How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 

Recently uploaded (20)

How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 

Write a BFS algorithm using only arrays and no other data structure..pdf

  • 1. Write a BFS algorithm using only arrays and no other data structure. Solution #include #include #include //For boolean char que[20]; int front=0, rear=0, n; char arr[20]; int bfs(int ); char ajMat[20][20]; char b[20]; void display(); int p=0; int main() { char v; int i, j; printf("Enter the number of nodes in a graph"); scanf("%d",&n); printf("Enter the value of node of graph"); for( i=0; i