Professional Documents
Culture Documents
Allama Iqbal Open University, Islamabad (Department of Computer Science) Warning
Allama Iqbal Open University, Islamabad (Department of Computer Science) Warning
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)
======