100% found this document useful (1 vote)
337 views2 pages

DAA SPPU Paper

The document discusses algorithms and their analysis. It contains four questions - the first asks about loop invariants and iterative algorithms, the second about proving correctness, the third analyzes best, average, and worst case for an algorithm and discusses P, NP, NP-hard, and NP-complete problems. The fourth asks about NP-complete problems and analyzes best, average, and worst case for a linear search algorithm.

Uploaded by

filescoding
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
337 views2 pages

DAA SPPU Paper

The document discusses algorithms and their analysis. It contains four questions - the first asks about loop invariants and iterative algorithms, the second about proving correctness, the third analyzes best, average, and worst case for an algorithm and discusses P, NP, NP-hard, and NP-complete problems. The fourth asks about NP-complete problems and analyzes best, average, and worst case for a linear search algorithm.

Uploaded by

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

Total No. of Questions : 4] SEAT No.

8
23
P8465 [Total No. of Pages : 2

ic-
Oct-22/BE/Insem-41

tat
B.E. (Computer Engineering)

9s
1:0
DESIGN AND ANALYSIS OF ALGORITHMS

02 91
3:4
(2019 Pattern) (Semester - VII) (410241)

0
21
Time : 1 Hour]
3/1 13 [Max. Marks : 30
0
Instructions to the candidates:
0/2
.23 GP

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


2) Neat diagrams must be drawn whenever necessary.
E
80

8
3) Figures to the right indicate full marks.
C

23
4) Assume suitable data, if necessary.

ic-
16

tat
8.2

9s
Q1) a) Why correctness of the algorithm is important? Define loop invariant
.24

1:0
property and prove the correctness of finding summation of n numbers
91
49

3:4
using loop invariant property. [8]
30

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


21

using examples. [7]


01
02

OR
0/2
GP

Q2) a) How to prove that an algorithm is correct? How to prove the correctness
3/1

of an algorithm using counter example? Give suitable example. [7]


CE
80

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

8
23
.23

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

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

9s

void sort (int a. int n) {


.24

1:0

int i, j;
91
49

3:4

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


30

j = i-1;
21

key = a[i];
01
02

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


0/2
GP

{
3/1

a[j+1] = a[j];
CE
80

j = j-1;
.23

}
a[j+1] = key;
16

}
8.2

}
.24

P.T.O.
49
b) • Explain P, NP, NP-Hard and NP-Complete problems with examples.

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

tat
in theoretical computer science?

9s
[7]

1:0
OR

02 91
3:4
Q4) a) What is NP-complete class problem? How would you prove vertex cover

0
21
3/1 13
problem is NP-complete class problem? [8]
b) What is Best, Average and Worst case Analysis of Algorithms? Analyse
0
0/2
.23 GP

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


int Linear-search(int a, int n, int item) {
E
80

8
C

23
int i;

ic-
for (i = 0; i < n; i++) {
16

tat
if (a[i] = = item) {
8.2

9s
.24

return a[i]
1:0
91
49

3:4
}
30
21

}
01
02

return - 1
0/2
GP
3/1
CE
80



8
23
.23

ic-
16

tat
8.2

9s
.24

1:0
91
49

3:4
30
21
01
02
0/2
GP
3/1
CE
80
.23
16
8.2
.24

Oct-22/BE/Insem-41 2
49

You might also like