Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Pir Meher Ali Shah

Arid Agriculture University, Rawalpindi


Office of the controller of Examinations
Final Exam / Spring 2020 (Paper Duration 12 hours)
To be filled by Teacher

Course No.: CS-721 Course Title: ANALYSIS OF ALOGORITHMS


Total Marks: 30 Date of Exam: 07-07-2021
Degree/Semester/Section:…BSCS/BSIT 4th semester
Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
__/30
Obtained
Total Marks in Words:
Name of the teacher: Dr. Tariq Ali
Who taught the course: Signature of teacher / Examiner:.

To be filled by Student

Registration No.: …………20-Arid-………….……… Name:………………………………………………………………….

Instructions: 1. Write your Name and Registration Number in the space provided above.
2. Save the file name “21-Arid-YourNo YourName Final21.doc”.
3. Upload file at least 1-2 hours before deadline.
4. After uploading view your uploaded file that either the file is correct or not?

Q.No.1:   [5 marks]
Consider the following chain of matrices having matrices A, B, C and D. You have to consider the
digits of your Registration Number in the order of the matrix as given. Add 2 to the digit if its zero.
For example, your Reg_No. 20-Arid-436 has last digit 6, 2 nd last digit 3 and 3rd last digit 4.
A B C
2 X last digit last digit X 2nd last digit 2nd last digit X 3nd last digit
D
3rd Last digit X 4
What will be the minimum number of multiplication to multiply these matrices? Show the order of
multiplication as well. [4+2 marks]
Q.No.2:
Consider the following graph. Add three edges weight according to your Reg_No. e.g. 20-Arid-436
has last digit 6, 2nd last digit 3 and 3rd last digit 4. Add the required number as shown in the graph if
any digit is zero.

9 3nd Last digit of your arid number, add 3 if its 0


6 D
B
12 7 E
A 2

8 20
C F Last digit of your arid number, add 1 if its 0
4
11
21
H
G
2nd Last digit of your arid number, add 2 if its 0

Apply kruskal algorithm on the above graph to compute Minimum Spanning Tree. Consider node A
as the starting vertex. Detailed steps of dry run are required in your solution. [6 marks]

Q.No.3:

9 3nd Last digit of your arid number, add 3 if its 0


6 D
B
12 7 E
A 2

8 C F Last digit of your arid number, add 1 if its 0


20
11
21
H
G
2nd Last digit of your arid number, add 2 if its 0

Consider the above Graph, apply Depth First Search algorithm. You are required to clearly show the
state of the stack at every iteration. [6 marks]
Q.No.4:

3nd Last digit of your arid number, add 3 if its 0


B
16 D
12

A Last digit of your arid number, add 1 if its 0


11
8 E
13
C 2nd Last digit of your arid number, add 2 if its 0

Apply floyd warshall algorithm on the above graph to compute shortest path from all vertices to
every vertex. [6 marks]

Q.No.5:
Assume F stand for first character of your name [6 marks]
S stand for second character of your name
And T stands for third character of your name
The language set contains only these three characters

Construct FSA for the pattern (F S F T S F), replace each with characters of yours name.

You might also like