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

Total No. of Questions : 4] SEAT No.

:
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

1) Answer the question of Q.1 or Q.2, Q.3 or Q.4.


2) Neat diagrams must be drawn whenever necessary.
CE
84

3) Figures to the right indicate full marks.


4) Assume suitable data, if necessary.
6

9
3.1

4:3
10

Q1) a) Why correctness of the algorithm is important? Define loop invariant

: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

b) What is iterative algorithm? Explain iteractive algorithm design issues


using examples. [7]
4.3 01
3/1

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

b) Write a short note on any 4 problem solving strategies. [8]


8
7.1

Q3) a) What is Best, Average and Worst case Analysis of Algorithms? Analyse
6

:39
3.1

the following algorithm Best, Average and Worst case [8]


4
10

3:3
void sort (int a. int n) {
int i, j;
21
0/2 1
7

for (i = 0; i < n; i++) {


02
38

j = i-1;
key = a[i];
01
3/1

while (j >=0 && a[j] > key)


7.1 GP
80

{
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.

• Explain 3-SAT problem using an example. Why is SAT so important

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

You might also like