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

Assignment 1

This document outlines 15 assignments related to algorithms and data structures: 1. Define minimum spanning tree and write Prim's algorithm to generate an MST for a given weighted graph. 2. Explain Kruskal's algorithm for finding a minimum cost spanning tree and determine its time complexity. 3. Explain the greedy algorithm design method and write an algorithm to solve a fractional knapsack problem. 4. Explain Dijkstra's single source shortest path algorithm and write the pseudocode. 5. Write Bellman-Ford's single source shortest path algorithm and apply it to a sample graph.

Uploaded by

shrinkhal03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Assignment 1

This document outlines 15 assignments related to algorithms and data structures: 1. Define minimum spanning tree and write Prim's algorithm to generate an MST for a given weighted graph. 2. Explain Kruskal's algorithm for finding a minimum cost spanning tree and determine its time complexity. 3. Explain the greedy algorithm design method and write an algorithm to solve a fractional knapsack problem. 4. Explain Dijkstra's single source shortest path algorithm and write the pseudocode. 5. Write Bellman-Ford's single source shortest path algorithm and apply it to a sample graph.

Uploaded by

shrinkhal03
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Class Assignment

1. Define minimum spanning tree (MST). Write Prim’s algorithm to generate a MST for any given weighted
graph. Generate MST for the following graph using Prim’s algorithm.

2. What is Minimum Cost Spanning Tree? Explain Kruskal’s algorithm and find MST of the graph. Also
write its Time-Complexity?

3. Explain and write an algorithm for greedy method of algorithm design. Given 10 activities along with their
start and finish time as
S = {A1, A2, A3, A4, A5, A6, A7, A8, A9, A10}
Start time = {1, 2, 3, 4, 7, 8, 9, 9, 11, 12}
Finish time = {3, 5, 4, 7, 10, 9, 11, 13, 12, 14}
4. Explain Single Source Shortest Path. Write its algorithm.
5. Write down Dijkstra’s algorithm for it. Write its algorithm.

While completing Assignment, every page should have your Name and Roll no. mentioned. (Important Note) else
you will not be awarded any marks.
6. Given a weighted directed graph G = (V, E) with source s and weight function W: E -> R, then write an
algorithm to solve a single source path problem whose complexity is O(VE). Apply the same on the
following graph.

7. Explain ‘greedy algorithm’. Write its pseudocode to prove that fractional knapsack problem has a greedy
choice property. Find the solution using greedy method.
N=8
P = {11, 21, 31, 33, 43, 53, 55, 65}
W = {1, 11, 21, 23, 33, 43, 45, 55}
M = 110
8. State Bellman ford algorithm.
9. Show how Prim’s algorithm can be implemented using heap. What would be the time complexity of an
algorithm?
10. Find the shortest path in the below graph from the source vertex 1 to all other vertices by using Dijkstra’s
algorithm.

11. When do Dijkstra and Bellman-ford algorithm both fail to find a shortest path? Can bellman ford detect all
negative weight cycles in a graph? Apply bellman ford algorithm on the following graph:

While completing the Assignment, every page should have your Name and Roll no. mentioned. (Important Note)
else you will not be awarded any marks.
12. Define Convex hull?
13. Show all the steps of Strassen’s matrix multiplication algorithm to multiply the following matrices

14. Write a randomized algorithm for two dimensional convex-hull problem. Find the time complexity of the
algorithm.
15. Given an integer x and a positive number n, use divide & conquer approach to write a function that
computes xn with time complexity O(log n).

While completing the Assignment, every page should have your Name and Roll no. mentioned. (Important Note)
else you will not be awarded any marks.

You might also like