160353_TA3.pdf

# 160353_TA3.pdf - Theoretical Assignment 3 Kunal Suryawanshi...

• Homework Help
• 4

This preview shows page 1 - 3 out of 4 pages.

Theoretical Assignment 3 Kunal Suryawanshi Roll No: 160353 April 12, 2018 1 Question 1 2 Question 2 2.1 Part 1 //Initilation index=0 for all(v V) mark[v]=”unvisited” T=Φ choose(s) //start vertex DFS(s, G) DFS(v, G) mark[v]=”visited” for all(w ADG g (v) ) if(mark[w]=”visited) //found cycle stop; if(mark[w]=”unvisited”) T=T (v,w) DFS(w,G) 2.2 Part 2 If Graph is not cyclic then:- It is not cyclic It is connected For checking connected: Keep a count of number of node visited. If count = n. Then connected. 1

Subscribe to view the full document.

3 Question 3 Path length can be calculated by forming a graph in which edges are words of dictionary. Every two words which differ by one word (second word can be formed by one insertion, deletion or replacement). After forming graph use BFS or DFS to find minimum length. D=(abc, bcd, acd, abd, bca, bac) A= abc B= bcd abc bac abd acd bcd bca struct Queue word length Queue Dic // insert all element of dictionary in Queue Queue temp while(Dic != is Empty) current = temp.front pointer = Dic.front while(Dic do not end)
• Winter '17
• R. K. Gosh
• Graph Theory, Graph theory objects, ABC Television

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern