You are on page 1of 2

ALLAMA IQBAL OPEN UNIVERSITY, ISLAMABAD

(Department of Computer Science)


WARNING
1. PLAGIARISM OR HIRING OF GHOST WRITER(S) FOR SOLVING
THE ASSIGNMENT(S) WILL DEBAR THE STUDENT FROM AWARD
OF DEGREE/CERTIFICATE, IF FOUND AT ANY STAGE.
2. SUBMITTING ASSIGNMENT(S) BORROWED OR STOLEN FROM
OTHER(S) AS ONE’S OWN WILL BE PENALIZED AS DEFINED IN
“AIOU PLAGIARISM POLICY”.
Course: Analysis & Design of Algorithms (3466) Semester: Autumn 2020
Level: BS (CS) Total Marks: 100
Pass Marks: 50
ASSIGNMENT No. 1
Note: All questions are compulsory. Each question carries equal marks.
Q. 1 Does every problem has an algorithm? And can we write a computer program for
every algorithm? (20)
Q. 2 Express the function n3/1000 —100n2 — 100n + 3 in terms of -notation (20)
Q. 3 Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic
definition of 0-notation, prove that max(f(n), g(n)) =  f(f(n) + g(n)). (20)
Q. 4 Use Strassen's algorithm to compute the following matrix product and show your
work: (20)
1 3 6 8
   
7 5  4
 2

Q. 5 How many people must there be in a room before the probability that someone
has the birthday as you do is at least ½? How many people must there be
before the probability that at least two people have a birthday on July 4 is
greater
than ½ ? (20)

ASSIGNMENT No. 2
Total Marks: 100
Pass Marks: 50
Note: All questions are compulsory. Each question carries equal marks.
Q. 1 What are the minimum and maximum number of elements in a heap of height h? (20)
Q. 2 Show that quick sort's best-case running time is Ω (n lg n). (20)
Q. 3 Which of the following sorting algorithms are stable: insertion sort, merge sort,
heap sort, and quick sort? (20)

Q. 4 Explain how to implement two stacks in one array A [1, ..., n] in such a way that
neither stack overflows unless the total' number of elements in both stacks together
is n, the PUSH and POP operations should run in 0(1) time. (20

Q. 5 For the set of {1, 4, 5, 10, 16, 17, 21} of keys, draw binary search trees of
height 2, 3, 4, 5, and 6. (20)
======

You might also like