0% found this document useful (0 votes)
90 views

DAA Assignment - 3 - Tut - 2

This document contains a tutorial sheet for the Design and Analysis of Algorithms course. It covers graph algorithms including spanning trees, adjacency matrices, shortest path algorithms like Dijkstra's and Bellman-Ford, and minimum spanning tree algorithms like Prim's and Kruskal's. Students are asked questions to test their knowledge of these topics, with the questions ranging from 2 to 11 marks each.

Uploaded by

megha.garg1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

DAA Assignment - 3 - Tut - 2

This document contains a tutorial sheet for the Design and Analysis of Algorithms course. It covers graph algorithms including spanning trees, adjacency matrices, shortest path algorithms like Dijkstra's and Bellman-Ford, and minimum spanning tree algorithms like Prim's and Kruskal's. Students are asked questions to test their knowledge of these topics, with the questions ranging from 2 to 11 marks each.

Uploaded by

megha.garg1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

B.Tech.

(Computer Science and Engineering)


Semester-V
Subject: Design and Analysis of Algorithms
Subject code BCO023A
Marks: 64

CO3: Knowledge of Graphs and their algorithms.

UNIT #3 Tutorial sheet 2


Sec-A (5x2=10marks)

1. [CO3]- What is a "spanning tree" of a graph, and why is it important in the study of graphs? [2 marks]
2. [CO3]- How can an "adjacency matrix" be used to represent a graph, and what are the advantages and
disadvantages of using this representation? [2 marks]
3. [CO3]- Compare and briefly state the time complexity of the following string-matching algorithms: Naive,
Knuth-Morris-Pratt (KMP), Rabin-Karp, Finite Automata, and Boyer-Moore. [2 marks]
4. [CO3]- Explain what a "shortest path" in a graph means and provide an example of a real-world scenario where
finding the shortest path in a graph is useful. [2 marks]
5. [CO3]- Compare and briefly state the time complexity of the following graph algorithms: Prim's algorithm,
Dijkstra's algorithm, the Bellman-Ford algorithm, and Kruskal's algorithm. [2 marks]

Sec-B
/* Note: Each question may have one or two parts */ (3x7=21 marks)

6. [CO3]-what is the Minimum Cost Spanning Tree? Explain Kruskal’s Algorithm and find the MST of
the graph. Also, write its Time-Complexity.

[7 marks]

7. [CO3]- Write the Knuth-Morris-Pratt (KMP) string matching algorithm, and using it, find all occurrences of the
pattern "ABC" in the text "ABCABCWABCABC”. [7 marks]

8. [CO3]- Apply the Boyer-Moore string matching algorithm to find and list all occurrences of the pattern
"XCDY" in the text "XYXCDYXCDYACDXCDY." Show the positions of pattern occurrences and
explain the key components that make Boyer-Moore efficient for this task. [7 marks]
Sec-C
/* Note: Each question may have one, two, or three parts */ [3*11=33 marks]

9. [CO3]
 Using the Rabin-Karp algorithm with a random prime number (e.g., 13) for the mod process, find
and list all occurrences of the pattern "31415" in the text "2718281828459043141592653." Show
the positions and steps taken during the search process, and indicate which hits are valid and
which are spurious. [7 marks]

 (b)- Explain the key principles of Dijkstra's algorithm for finding the shortest path in a weighted
graph. Highlight the importance of maintaining a priority queue for efficient implementation.
[4 marks]

10. [CO3] -Define the Floyd Warshall Algorithm for all pair shortest paths and apply the same on the
following graph. [11 marks]

11. [CO3]- Given the following graph, apply both Prim's and Kruskal's algorithms to find the minimum
cost-spanning tree in both cases. Provide the steps and final results for each algorithm. [11 marks]

You might also like