Assignment 1
Assignment 1
ASSIGNMENT I
Q Questions CO’
N s
o
1 Define algorithm. What are the criteria that an algorithm must satisfy? Explain with an example. C01
2 With the help of flowchart, explain the various steps in algorithm design and analysing process Co1
4 Write an algorithm to find the GCD of two numbers using Euclids Algorithm. Co1
5 Explain the asymptotic notations BIG O, BIG Omega, BIG Theta used to compare orders of growth Co1
of an algorithm
6 explain basic efficiency classes. Prove the following statements. Co1
a. 100n + 5 =O(n2) b. n2 + 5n + 7 = Θ(n2) Co1
6 6.Design an algorithm to search an element in a array using linear search, Discuss the worst case, Co1
best case and average case efficiency of this algorithm
9 Write brute force string matching algorithm and mention its efficiency, find the number of Co1
character comparisons that will be made by the algorithm for the pattern ABABC in the following
text BAABABABCCA
10 Explain the concept of Brute force approach. Design an algorithm for Selection sort and trace with Co1
an example and derive its time Complexity.
11 Explain the general plan for analysing the efficiency of a recursive algorithm. Write the algorithm Co1
to count number of binary digits in N’s binary representation. Derive its efficiency.
12 Write a recursive algorithm to calculate a factorial of a number and also bring out its efficiency. Co1
13 Sort the list 75,65,55,45,35,25 to arrange in ascending order using decrease and conquer technique Co2
showing the traces of its working and find its complexity. Also write the algorithm used
14 Define Topological sorting. Apply the DFS based and Source removal algorithm to solve the Co2
topological sorting problem for the following digraph.
15 Co2
16 What is an Exhaustive search approach and apply the same to obtain solution to Knapsack problem. Co2
Knapsack capacity W=10
17 Item 1 2 3 4 Co2
Weight 4 7 5 3
Profit 40 42 25 12
18 Design an algorithm of merge Sort and find its efficiency. Trace 60, 50, 25, 10, 35, 25, 75. 30. Co2