www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS502 Fundamentals of Algorithms Assignment No 01 Spring 2019 Solution & Discussion Due Date: 15-05-2019

CS502 Fundamentals of Algorithms Assignment No 01 Spring 2019 Solution & Discussion Due Date: 15-05-2019

Question No  01:   (Marks:  10)

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.

1    Matrix_Multiplication (A[][], B[][],Mul[][], int n)

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.

Question No. 02   (Marks   10)

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=======================================

For any query about the assignment, contact at CS502@vu.edu.pk

GOOD LUCK

Views: 5954

Attachments:

### Replies to This Discussion

CS502 Assignment#01 Spring 2019 Solution

Kindly share once you complete it

CS502 Assignment Solution

CS502 Assignment#01 Spring 2019 Solution

is it correct?

CS502 Assignment#01 Spring 2019 Solution

Attachments:

CS502 Assignment#01 Some more ideas solution

Attachments:

CS502 Assignment 1 Solution

Attachments:

wrong solution

correct solution

Attachments:

kindly confirm kren kon sa solution correct hy?

1

2

3

4

5

## Latest Activity

Shoaib Hasan Khan updated their profile
31 minutes ago
memon added a discussion to the group CS615 Software Project Management

### cs615 midterm paper fall 2021

1 hour ago
2 hours ago
alvia khan posted a discussion

10 hours ago

### ENG502 Current Midterm Paper 20/1/2022 5:30pm

12 hours ago
pcscrack posted a blog post

### EaseUS Partition Master License Code

14 hours ago
Nida Arshad Javaid Ch posted a video

14 hours ago
16 hours ago