BE COMP - Design and Analysis of Algorithms
BE COMP - Design and Analysis of Algorithms
:
P8465 [Total No. of Pages : 2
Oct-22/BE/Insem-41
9
4:3
B.E. (Computer Engineering)
:3
13
DESIGN AND ANALYSIS OFALGORITHMS
/10 71
22
(2019 Pattern) (Semester - VII) (410241)
8
/20
.38 13
Time : 1 Hour] [Max. Marks : 30
0
Instructions to the candidates:
03
7.1 GP
9
3.1
4:3
10
:3
13
property and prove the correctness of finding summation of n numbers
using loop invariant property. 0/2 1 [8]
2
7
02
8 0 38
OR
GP
Q2) a) How to prove that an algorithm is correct? How to prove the correctness
of an algorithm using counter example? Give suitable example. [7]
CE
Q3) a) What is Best, Average and Worst case Analysis of Algorithms? Analyse
6
:39
3.1
3:3
void sort (int a. int n) {
int i, j;
21
0/2 1
7
j = i-1;
key = a[i];
01
3/1
{
a[j+1] = a[j];
.3
CE
84
j = j-1;
}
6
a[j+1] = key;
3.1
}
10
}
P.T.O.
b) • Explain P, NP, NP-Hard and NP-Complete problems with examples.
9
4:3
in theoretical computer science?
[7]
:3
13
OR
/10 71
22
Q4) a) What is NP-complete class problem? How would you prove vertex cover
8
/20
.38 13
problem is NP-complete class problem? [8]
b) What is Best, Average and Worst case Analysis of Algorithms? Analyse
0
03
7.1 GP
the following algorithm Best, Average and Worst case [7]
int Linear-search(int a, int n, int item) {
CE
84
int i;
for (i = 0; i < n; i++) {
6
9
3.1
4:3
if (a[i] = = item) {
10
:3
return a[i]
13
} 0/2 1
2
7
02
8 0 38
}
4.3 01
return - 1
3/1
GP
CE
8
7.1
6
:39
3.1
4
10
3:3
21
0/2 1
7
02
38
01
3/1
7.1 GP
.3 80
CE
84
6
3.1
10
Oct-22/BE/Insem-41 2