Documente Academic
Documente Profesional
Documente Cultură
01
Total Marks: 20
SEMESTER Spring 2019
CS502- Fundamentals of Algorithms Due Date: 15/05/2019
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit if:
The assignment is submitted after due date.
The submitted assignment does not open or file corrupt.
The assignment is full or partially copied from (other student or ditto copy from handouts or internet).
Student ID is not mentioned in the assignment File or name of file is other than student ID.
The assignment is not submitted in .doc or .docx format.
Uploading instructions
Your submission must include:
Objective
The objective of this assignment is
To give basic knowledge and understanding of Algorithms.
To be able to understand and calculate the complexity of algorithms.
To be able to understand the growth rate of algorithms.
Note:
Your answer must follow the below given specifications.
Font style: “Times New Roman”
Font color: “Black”
Font size: “12”
Bold for heading only.
Font in Italic is not allowed at all.
No formatting or bullets are allowed to use.
Your answer should be precise and to the point, avoid irrelevant detail.
The following algorithm (procedure) is computing the multiplication of two squared matrices. A[][] and B[][] are
two squared matrices, Mul[][] is a square matrix which store the multiplication of A[][] and B[][]. As the matrices
are squared so, “n” would be the number of columns or rows. You are required to calculate the worst case time
complexity {T(n)} of this algorithm.
2 Sum = 0
3 for (int i to n)
4 for (int j to n)
5 for (int k to n)
6 Sum = Sum + A[i][k] * B[k][j];
7 Mul[i][j] = Sum;
Note: Make sure that the alignment of each step/line is important in the algorithm, because it may indicate you that
the loops are nested or in sequence.
Consider the following function f(n) which represent the time complexity of an algorithm.
f(n) = 2n2 + 4n + 7
As per the definition of Big O, we have, 0 ≤ f(n) ≤ cg(n) , where c >0 and n ≥ n0
If g(n) = n2 , find the value of c for which the upper bound cg(n) holds.
=====================================Ended=======================================
GOOD LUCK