Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1. What are the characteristics of an algorithm?

2. Write the different methods to solve the recurrence equation.


3. What is P-class problem?
4. What will be the time complexity of the given program segment?

int fact ( int n)

if(n==0)

return 1;

else

return n* fact(n-1);

5. Rank the following functions by their order of growth in ascending order.

n2, n, ln n, n3, 2n

6. Write the Different steps of divide and conquer algorithm.


7. Show that (n+1)5 is O (n5).
8. What are the different algorithms to search an element?
9. Write the procedure of Substitution method to solve the recurrence equation.
10. Which data structure is used in BFS and DFS?
11. Solve the Recurrence relation T(N) = 2T(N/4) + N, for N≥2 with T(1) = 1.
12. Explain the various criteria used for analyzing algorithms.
13. What is meant by divide &conquer?
14. Consider the recurrence
𝑇𝑛 = {1 𝑛 = 1 2𝑇(⌊𝑛/2⌋ ) + 𝑛 𝑛 >1
Find the asymptotic bound on T.
15. Find out the asymptotic bound for the given recurrence using recursion tree method.
T(n) = 3T(n/4) + cn2
16. Find out the asymptotic bound for the given recurrence equation by using recurrence
method. T(n) = 2T(n/2) + n2.
17. Find out the asymptotic bound for the given recurrence equation by using recurrence
method. T(n) = T(n/3) + T(2n/3) + n.
18. Give two real time problems that could be solved using greedy algorithm.
19.
20. Use master method to solve the following recurrence
T(n)=9T(n/3) + n
21. Differentiate between dynamic programming and Divide and conquer method.
22. Find the worst case time complexity of Quick sort?
23. Define NP-Complete and NP-Hard problem.
24. How is O-notation different form Ω -notation?
25. Differentiate between BFS and DFS.
26. Solve the given text using Brute force string matching algorithm with the given pattern.
Text= TWO ROADS DIVERGED IN A YELLOW WOOD
Pattern= ROADS
27. Write the algorithm of Quick sort.
28. Find the worst case time complexity of quick sort with recurrence equation.
29. Sort the following elements using Merge sort: 7, 5, 4, 8, 12, 10, 9, 6, 2, 4
30. Write an algorithm of Floyd’s Algorithm with the time complexity.
31. Take any undirected graph and find the MST using Kruskal’s algorithm.
32. Take any undirected graph and find the MST using Prim’s algorithm.
33. Explain the step by step procedure of Dijkstra’s algorithm.
34. What is Knapsack problem? Write the different knapsack problems. Explain the procedure of
0/1 Knapsack problem.
35. Define P, NP and NP- Complete Problems.
36. Determine minimal spanning tree for given graph using Prim’s algorithm.

37. Determine minimal spanning tree for given graph using Kruskal’s algorithm.

38. Use Dijkstra’s algorithm for solving single source shortest path problem on a given directed
graph.

39. Implement the fractional knapsack problem using C. Let us consider that the capacity of the
knapsack W = 60 and the list of provided items are shown in the following table −

Item A B C D

Profit 80 10 20 30

Weight 40 5 10 4

40. Write an algorithm for Huffman tree. Construct a Huffman tree for the given text and the
text is “DESIGN AND ANALYSIS OF ALGORITHM”. Show binary encoding of each character.
41. Write an algorithm for Huffman tree. The frequency with which each character occurs in a
file is shown in the given table. Construct a Huffman tree corresponding to these frequencies
and show binary encoding of each character.

Character a b c d e f g h
Frequency 1 8 7 10 12 5 4 2

42. Write an algorithm Fractional Knapsack. Suppose the capacity of the knapsack is 30.
The Profit array is {25, 30, 40} and the corresponding Weight array is {10, 15,
18}.Find profit based on minimum weight.
43. What is the difference between fixed length codeword and variable length code word.
Explain with an example.
44. For the following graph having four nodes represented by the matrix given below
determine the all pairs source shortest path.

45. Discuss the classes P, NP, NP complete, and NP hard with examples. How can we
show that a problem is NP complete?
46. What do you understand by Polynomial time reducibility?
47. Use Floyd’s-Warshall’s algorithm to find the shortest paths for all pairs of vertices in
the given graph.

48. Write an algorithm for Selection Sort and sort the following elements: 7, 5, 4, 8, 12, 10, 9, 6,
2, 4
49. Write an algorithm for Bubble Sort and sort the following elements: 7, 5, 4, 8, 12, 10, 9, 6, 2,
4
50. Write an algorithm for Sequential Sort and sort the following elements: 7, 5, 4, 8, 12, 10, 9,
6, 2, 4
51. Write an algorithm for Depth-First Search (DFS) and find its time complexity.
52. Write an algorithm for Breadth-First Search (BFS) and find its time complexity.

You might also like