SlideShare a Scribd company logo
1 of 1
Write code in C++
Write a program to perform a topological sort on a graph.
*Use adjacency matrix
Use these Variables: int L1, L2, L3, noVertices, adjMatrix[10][10], indegree[10], swap;
*Add Comments
Solution
#include #include using namespace std; struct node_info { int no; int lv_time, st_time; }*q =
NULL, *r = NULL; struct node { node_info *pt; node *next; }*top = NULL, *p = NULL, *np =
NULL; int c = 0; void push(node_info *ptr) { np = new node; np->pt = ptr; np->next = NULL; if
(top == NULL) { top = np; } else { np->next = top; top = np; } } node_info *pop() { if (top ==
NULL) { cout<<"underflow "; } else { p = top; top = top->next; return(p->pt); delete(p); } }
void topo(int *v,int am[][7],int i) { q = new node_info; q->no = i; q->st_time = c; cout<<"start
time for node no "< no<<":"< no<<":"< >am[i][j]; } } topo(v,am,0); getch(); }

More Related Content

Similar to Write code in C++ Write a program to perform a topological sort on a g.docx

Use Python Code to add a block of code to count the number of dots wit.pdf
Use Python Code to add a block of code to count the number of dots wit.pdfUse Python Code to add a block of code to count the number of dots wit.pdf
Use Python Code to add a block of code to count the number of dots wit.pdfaonetechcomputers
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docxAdamq0DJonese
 
Please fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdfPlease fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdfamarnathmahajansport
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYMalikireddy Bramhananda Reddy
 
C Recursion, Pointers, Dynamic memory management
C Recursion, Pointers, Dynamic memory managementC Recursion, Pointers, Dynamic memory management
C Recursion, Pointers, Dynamic memory managementSreedhar Chowdam
 
#includeiostream struct node {    char value;    struct no.pdf
#includeiostream struct node {    char value;    struct no.pdf#includeiostream struct node {    char value;    struct no.pdf
#includeiostream struct node {    char value;    struct no.pdfankitmobileshop235
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxhappycocoman
 
pleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfpleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfwasemanivytreenrco51
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdfanupambedcovers
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracingSamsil Arefin
 
Class 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibClass 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibMarc Gouw
 
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfDoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfaathiauto
 
DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++mustkeem khan
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diplomamustkeem khan
 

Similar to Write code in C++ Write a program to perform a topological sort on a g.docx (20)

Use Python Code to add a block of code to count the number of dots wit.pdf
Use Python Code to add a block of code to count the number of dots wit.pdfUse Python Code to add a block of code to count the number of dots wit.pdf
Use Python Code to add a block of code to count the number of dots wit.pdf
 
Link list
Link listLink list
Link list
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
 
Please fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdfPlease fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdf
 
week-4x
week-4xweek-4x
week-4x
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
 
Struct examples
Struct examplesStruct examples
Struct examples
 
C Recursion, Pointers, Dynamic memory management
C Recursion, Pointers, Dynamic memory managementC Recursion, Pointers, Dynamic memory management
C Recursion, Pointers, Dynamic memory management
 
#includeiostream struct node {    char value;    struct no.pdf
#includeiostream struct node {    char value;    struct no.pdf#includeiostream struct node {    char value;    struct no.pdf
#includeiostream struct node {    char value;    struct no.pdf
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
 
pleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfpleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdf
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdf
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracing
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Class 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibClass 8b: Numpy & Matplotlib
Class 8b: Numpy & Matplotlib
 
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfDoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
 
Ch8a
Ch8aCh8a
Ch8a
 
DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diploma
 

More from karlynwih

Zone Diameter Interpretation Examine the zone diameter data in the tab.docx
Zone Diameter Interpretation Examine the zone diameter data in the tab.docxZone Diameter Interpretation Examine the zone diameter data in the tab.docx
Zone Diameter Interpretation Examine the zone diameter data in the tab.docxkarlynwih
 
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docx
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docxYour unknown bacteria maybe one of the following 13 bacteria- Proteus.docx
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docxkarlynwih
 
Your friend got a notification on their iPhone letting them know they.docx
Your friend got a notification on their iPhone letting them know they.docxYour friend got a notification on their iPhone letting them know they.docx
Your friend got a notification on their iPhone letting them know they.docxkarlynwih
 
Your reflection must be at least 400 words Examine habitat for humanit.docx
Your reflection must be at least 400 words Examine habitat for humanit.docxYour reflection must be at least 400 words Examine habitat for humanit.docx
Your reflection must be at least 400 words Examine habitat for humanit.docxkarlynwih
 
You will learn about the Chain of Infection and apply your learning to.docx
You will learn about the Chain of Infection and apply your learning to.docxYou will learn about the Chain of Infection and apply your learning to.docx
You will learn about the Chain of Infection and apply your learning to.docxkarlynwih
 
Write definitions for the following terms- hydrograph- hyetograph- abs.docx
Write definitions for the following terms- hydrograph- hyetograph- abs.docxWrite definitions for the following terms- hydrograph- hyetograph- abs.docx
Write definitions for the following terms- hydrograph- hyetograph- abs.docxkarlynwih
 
Write C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docxWrite C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docxkarlynwih
 
Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxkarlynwih
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxkarlynwih
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxkarlynwih
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxkarlynwih
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxkarlynwih
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxkarlynwih
 
Write an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxWrite an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxkarlynwih
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxkarlynwih
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docxkarlynwih
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxkarlynwih
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxkarlynwih
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxkarlynwih
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docxkarlynwih
 

More from karlynwih (20)

Zone Diameter Interpretation Examine the zone diameter data in the tab.docx
Zone Diameter Interpretation Examine the zone diameter data in the tab.docxZone Diameter Interpretation Examine the zone diameter data in the tab.docx
Zone Diameter Interpretation Examine the zone diameter data in the tab.docx
 
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docx
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docxYour unknown bacteria maybe one of the following 13 bacteria- Proteus.docx
Your unknown bacteria maybe one of the following 13 bacteria- Proteus.docx
 
Your friend got a notification on their iPhone letting them know they.docx
Your friend got a notification on their iPhone letting them know they.docxYour friend got a notification on their iPhone letting them know they.docx
Your friend got a notification on their iPhone letting them know they.docx
 
Your reflection must be at least 400 words Examine habitat for humanit.docx
Your reflection must be at least 400 words Examine habitat for humanit.docxYour reflection must be at least 400 words Examine habitat for humanit.docx
Your reflection must be at least 400 words Examine habitat for humanit.docx
 
You will learn about the Chain of Infection and apply your learning to.docx
You will learn about the Chain of Infection and apply your learning to.docxYou will learn about the Chain of Infection and apply your learning to.docx
You will learn about the Chain of Infection and apply your learning to.docx
 
Write definitions for the following terms- hydrograph- hyetograph- abs.docx
Write definitions for the following terms- hydrograph- hyetograph- abs.docxWrite definitions for the following terms- hydrograph- hyetograph- abs.docx
Write definitions for the following terms- hydrograph- hyetograph- abs.docx
 
Write C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docxWrite C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docx
 
Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docx
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docx
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docx
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docx
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docx
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docx
 
Write an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxWrite an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docx
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docx
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docx
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docx
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docx
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docx
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docx
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 

Write code in C++ Write a program to perform a topological sort on a g.docx

  • 1. Write code in C++ Write a program to perform a topological sort on a graph. *Use adjacency matrix Use these Variables: int L1, L2, L3, noVertices, adjMatrix[10][10], indegree[10], swap; *Add Comments Solution #include #include using namespace std; struct node_info { int no; int lv_time, st_time; }*q = NULL, *r = NULL; struct node { node_info *pt; node *next; }*top = NULL, *p = NULL, *np = NULL; int c = 0; void push(node_info *ptr) { np = new node; np->pt = ptr; np->next = NULL; if (top == NULL) { top = np; } else { np->next = top; top = np; } } node_info *pop() { if (top == NULL) { cout<<"underflow "; } else { p = top; top = top->next; return(p->pt); delete(p); } } void topo(int *v,int am[][7],int i) { q = new node_info; q->no = i; q->st_time = c; cout<<"start time for node no "< no<<":"< no<<":"< >am[i][j]; } } topo(v,am,0); getch(); }