Design & Analysis of Algorithms- Spring 2013 BSCS Quiz No.

1
Roll No ___________

20th February, 2013
Time: 15 minutes Total Marks: 10

Name:___________________________

Q1: State at least four distinct properties of an “Algorithm”. (4 marks) i)

ii)

iii)

iv)

Q2: Write the time complexity of following algorithms in the given space? (3+3 marks)

(a)

int x = 0; for ( int j = 1; j <= n/2; j++ ) for ( int k = 1; k <= n*n; k++ ) x = x + j + k;

(b)

int x = 0; for ( int j = 1; j <= n; j++ ) for ( int k = 1; k < 3*j; k++ ) x = x + j;

Sign up to vote on this title
UsefulNot useful