Вы находитесь на странице: 1из 7

1. Mention the 3 requirements to be satisfied by any greedy algorithm.

2. Write Kruskal’s algorithm to find the minimum cost spanning tree. Also mention its time complexity.
3. What is a heap? Give an algorithm to construct a heap for the elements of given array by bottom up
approach. What is its complexity? Show heap construction for the given list 2,9,7,6,5,8 stage by stage
4. Justify the statement “Prim’s algorithm always yields minimum cost spanning tree”. Give the Prim’s
algorithm and discuss about its complexity.
5. Give Dijkstra’s algorithm. What is its complexity? Discuss with a simple example.
6. What is greedy technique? Explain how different steps of this technique are taken care in generating a
minimum spanning tree through a sequence of expanding subtrees. Apply this algorithm to the following
graph

7. Write Kruskal’s algorithm. What are its applications? How is it different from prim’s algorithm?
8. Sort the elements {S, O, R, T, I, N, G} in alphabetical order using Heapsort method.
9. Apply Kruskal’s algorithm to find a minimum spanning tree of the following
graph.

10. Construct a Huffman code for the following


Character A B C D E

Probability 0.4 0.1 0.2 0.14 0.16

Encode the text ABACABAD using the above code. Decode the text whose encoding 100010111001010, using
the above Huffman code.
15. Define a heap. Prove that a n-element heap has height [log n]. Show that there is a linear algorithm to
construct a heap of size n.
16. What is the running time of heapsort on an array A of length n. that is already sorted in increasing order?
What about decreasing order?
17. Give Huffman’s algorithm to construct Huffman tree and explain same with suitable example.
18. Using greedy method trace the following graph to get shortest path from vertex a to all other vertices.

19. Write an algorithm to construct heap in the bottom – up manner, hence apply the same to construct the
heap to the list -1,8,6,5,3,7,4.
20. Explain the concepts of greedy technique for prism’s algorithm. obtain minimum cost spanning tree for the
graph whose weight matrix is given below

21. What is the minimum cost of spanning tree? Apply Prim’s and Krushal’s algorithm on below fig.

22. Write Dijkstra’s shortest path algorithm. Apply Dijkstra’s algorithm on figure below to obtain shortest path.

23. Using the prim’s algorithm, determine the minimum cost spanning tree for the graph of the figure
24. Design the Dijkstra’s algorithm and apply the same to find the single source shortest paths problem for the
graph taking vertex ‘a’ as source in the figure below:-

25. Write greedy method control abstraction for subset paradigm.


26. Using greedy method, trace the following graph to set shortest path from vertex ‘a’ to all other vertices.

27. Apply Prim’s algorithm for the following graph to find the maximum spanning tree

28. Define minimum cost spanning tree. Give high level distribution of Prim’s algorithm to find minimum
spanning tree and find minimum spanning tree graph shown in figure below using Prim’s algorithm.
29. Write Kruskal’s algorithm to construct a minimum spanning tree and show that the time efficiency is
O(|∈|log|∈|).
30. Apply Kruskal’s algorithm to find the min spanning tree of the graph

31. Explain the concept of greedy technique for Prim’s algorithm. Obtain minimum cost spanning tree for the
graph below Prim’s algorithm.

32. Solve the following single source shortest path problem assuming vertex 5 as the source.

33. Solve the following instance of Knapsack problem, using greedy algorithm
Item 1 2 3 4
Weight 4 7 5 3

Profit 40 42 25 12

Knapsack weight M=10


34. Using Prim’s algorithm, determine minimum cost spanning tree for the following graph

How Knapsack and Prim’s algorithms guarantee the elimination of cycles?


35. In the above figure, determine the shortest distances from source vertex 5 to all the remaining vertices,
using Dijikstra’s algorithm.
36. Develop an algorithm for “comparison counting sort” sort the following list 62, 31, 84, 96,19, 47 in ascending
order using the same method.
37. Design an algorithm for single source shortest path problem.
Using Prim’s algorithm, determine minimum cost spanning tree for the weighted graph shown below

38. What are Huffman’s trees? Explain. Give the different types of Huffman’s encoding. Construct a Huffman
code for the following data
Character A B C D -

Probability 0.4 0.1 0.2 0.15 0.15

Encode the following code, using Huffman’s encoding: ABCD-ABAC

39. Find the minimum spanning tree, using Prim’s method for the graph shown below:

40. Find the single source shortest paths. Apply the Dijkstra’s algorithm top the figure below, to get the shortest
path form the vertex to all the other vertices

41. Write a bottom-up dynamic algorithm for the knapsack problem. Apply it on the following instance of the
knapsack problem.
Item Weight Value

1 2 3

2 3 4

3 4 5

4 5 6

42. Using Kruskal’s algorithm, obtain a minimum cost spanning tree for the graph given below:-
43. Construct a Huffman code for the following data:
Character A B C D E

Probability 0.4 0.1 0.2 0.15 0.15

Decode the text whose encoding is 100010111001010 using the above Huffman code.
44. What are Huffman codes and trees? Discuss the advantage of Huffman’s code.
45. Use Kruskal’s method to find min cost spanning tree for the below graph.

Вам также может понравиться