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

Department of Computer Technology Anna University:: Chennai, Mit Campus Chrompet, Chennai - 44

This document contains 12 practice questions on the design and analysis of algorithms. The questions cover topics such as calculating time complexity of algorithms, analyzing asymptotic notation relationships, designing algorithms to implement a cipher, calculating ways for a robot to walk a certain distance recursively, solving algorithmic recurrence relations using various methods like substitution, recursion trees and master's method, and explaining little-oh and little-omega notation. The document provides references to textbooks on algorithms for further study.

Uploaded by

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

Department of Computer Technology Anna University:: Chennai, Mit Campus Chrompet, Chennai - 44

This document contains 12 practice questions on the design and analysis of algorithms. The questions cover topics such as calculating time complexity of algorithms, analyzing asymptotic notation relationships, designing algorithms to implement a cipher, calculating ways for a robot to walk a certain distance recursively, solving algorithmic recurrence relations using various methods like substitution, recursion trees and master's method, and explaining little-oh and little-omega notation. The document provides references to textbooks on algorithms for further study.

Uploaded by

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

DEPARTMENT OF COMPUTER TECHNOLOGY

ANNA UNIVERSITY:: CHENNAI, MIT CAMPUS


CHROMPET, CHENNAI -44
PRACTISE QUESTIONS- SET 1
CS9201-DESIGN & ANALYSIS OF ALGORITHMS
CSE(3/8) [R] & [SS]
1)Calculate the time complexity for the following algorithms.
a) //a,b,c =>two dimensional arrays
Algorithm add(a,b,c,n)
{
for i=1 to n do
for j=1 to n do
c[I,j]=a[I,j]+b[i,j]
}
b) Algorithm demo1(n)
{
for i=1 to n do
for j=1 to i do
for k=1 to j do
x=x+1
}
c) Algorithm demo2(n)
{
i=1
while( i <= n) do
{
x=x+1
i=i+1
}
}
2)Check whether the following equalities are correct
a)

n!= O(nn)

b)

n3 +10 6n2=(n3)

c)

log3n =O(n1/3)

d)

2n22n+nlogn= (n22n)

e)

3logn+loglogn =(logn)

f)

10n2 + 9 =O(n)

3) Cipher is a method of hiding messages by encoding them. One very simple CIPHER is by
one to one substitution of letters, for example
Original

: AB C D E F G H I J

K L M NO P Q R S T

UVWXYZ

Cipher Code

:FGHI J KLMNO PQRST UVWXY ZA BCDE

Thus the word CAT will be send as HFY. Design an efficient algorithm which implements the
above logic.
4) A robot can take steps of 1 meters, 2 meters, or 3 meters. Design the pseudocode for a
recursive algorithm to calculate the number of ways the robot can walk n meters. Give a proof
using induction that your algorithm is correct.
5) Let T(n) = 45n4-5n2+4n-456. Show T(n)= O(T1(n))=(T1(n))=(T1(n))
where T1(n)=n4. Obtain G1(n) and G2(n) where T(n)=o(G1(n))=(G2(n)).
6)Solve the following recurrence equations ,defining T(n) as,
a)

T(n)=

4
T(n-1)+4

if n=1
otherwise

Show that by induction T(n)= 4n


b)

T(n)= 2T(n1/2)+log n

if n>1 ( check the appropriate boundary conditions)

7)Solve the recurrence equation by substitution method , specify the upper,lower and tight
bounds
a)

T(n)=

c
2T(n/2)+bnlogn

if n<2
otherwise

b)

T(n)=

c
16T(n/4)+n2

if n<=2
otherwise

c)

T(n)=

c
T(9n/10)+n

if n<=2
otherwise

8)Consider the following recursive equation T(n)=3T(n/2)+n .Determine the upper bound using
recursion tree .Verify your answer with substitution and master method.
9)Solve the following recurrence equation using Masters method ,specify the upper,lower and
tight bounds
a) T(n)=

b) T(n)=

c
4T(n/2)+n2n
c
7T(n/3) + n2

for sufficiently small n


otherwise
n<=2
otherwise

10) Try to explain what is Little Oh and Little Omega. Can you relate and compare it with Big
Oh and Big Omega. (Optional Question)
11) Write an algorithm using recursion to compute GCD of two non negative numbers without
using division operation. Determine its time complexity and appropriate bounds.
12) Give a brief study on algorithm efficiency and asymptotic notations.

With Reference to ,
1) Fundamentals of Computer Algorithms ,Horowitz,Sahni,Sanguthevar
2) Computer Algorithms,Introduction to Design & Analysis,Sara Baase,Allen
3) Algorithm Design,Foundations,Analysis and Internet Examples, Michael.T.Goodrich,
Roberto
4)Introduction to Algorithms, T.H.Cormen

You might also like