Shaheed Zulfikar Ali Bhutto Institute of Science & Technology
COMPUTER SCIENCE DEPARTMENT
Total Marks: 04
Obtained Marks:
Design and Analysis of
Algorithm
Assignment # 02
Submitted To: Mr. Rana Faisal Hayat
_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Student Name: ______________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Reg. Number:
______________________________________________________________________________________________________________________________________________________________________________________________________________________________________
DAA BSCS-4 SZABIST-ISB
Shaheed Zulfikar Ali Bhutto Institute of Science & Technology
COMPUTER SCIENCE DEPARTMENT
Instructions: Submission Guidelines:
1. Your assignment should be in handwritten form and on white
page.
2. Each question should be answered separately and clearly labelled.
3. Use appropriate citations and references if you consult external sources.
4. Ensure that your answers are well-structured and free from spelling and grammatical
errors.
5. Plagiarism will not be tolerated. Please make sure your answers are in your own words,
and any external sources are properly cited.
6. Copied or shown assignments will be marked zero.
7. Late submissions are not entertained in any case.
8. Scan it and make PDF and submit online.
Q1. Give the O(f(n)) for the following.
a. f(n) = n3+n2+sin(n)
b. f(n) = n(n2+1)(n-5)
c. f(n) = (n log n+1)(n2+n+1)
Q2. Make a table for n=1 to 10 and generate a table to show how the following
functions grow. If the values go very high, using the table, determine which function
grows faster.
a. n log n
b. n2
c. log(n+1)
d. 15 log n
e. 32n
Q3. Two algorithms, A and B have running time 100n2 and 2n respectively, on the
same machine. Find the smallest value of n for which A beats B.
DAA BSCS-4 SZABIST-ISB