We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

CS502 Assignment No 01 Fall 2020 Solution & Discussion Due Date: 26-11-2020

Question No 01:                                                                                                                                (Marks:  10)

You are required to find the time complexity of the following codes with respect to worst case.

Part A:

for (i = 1 ; i<= n; i++)

{

            for (i = 1 ; i<= n2 ; i++)

            {

                        for (i = 1 ; i<= n3 ; i++)

                        {

                        a = x+y;

}

}

  }

Part B:

 

for ( y = 1 ; y <= n; i++)

{

            for (i = 1 ; i<= n2 ; i++)

            {

                        for (i = 1 ; i<= n3 ; i++)

                        {

                        a = x+y;

}

}

  }

 

 

Question No 02:                                                                                                                                (Marks:  10)

Write a simple algorithm (Only Pseudo code) about making 3x3 matrix table and also calculate the worst case time complexity T(n).

1

2

3

4

5

6

7

8

9

 

=====================================Ended=======================================

 

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

 

GOOD LUCK


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 1802

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided. 

 

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

 

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

Click Here to Search (Looking For something at vustudents.ning.com?)

Click Here to Join (Our facebook study Group)

 

**************

**********

CS502 One more idea solution file 

Download on the below link 

CS502-Assignment-no. 1-Idea-Solution

CS502 Assignment No 01 Solution 100% Correct

/**************

CS502 Assignment#01 Solution Fall 2020

Click on the below link 

CS502_Assignment_No_01_Solution_Fall_2020

CS502 Assignment#01 Solution Fall 2020

Question No 01 Solution
Part A:
for (i = 1 ; i<= n; i++)……n times
{
for (i = 1 ; i<= n2 ; i++)…….n2 times
{
for (i = 1 ; i<= n3 ; i++)……n3 times
{
a = x+y;……. Constant c
}
}
}
T(n)=n*n2*n3+c
T(n)=n6+c
T(n)=n6
Part B:

for ( y = 1 ; y <= n; i++)……n times
{
for (i = 1 ; i<= n2 ; i++)…….n2 times
{
for (i = 1 ; i<= n3 ; i++)……n3 times
{
a = x+y;……. Constant c
}
}
}

T(n)=n*n2*n3+c
T(n)=n6+c
T(n)=n6

Question No 02 Solution
matrix (int rows, int columns)
array matrix [rows][columns]
for i 1 to rows…….n times{
do for j 1 to columns…….n times{
do print Matrix[rows][columns]tab;
}
print endline;
T(n)=n*n=n2

CS502 Solution File

Link below 

CS502-Sol-Assig#01-Fall-2020

CS502 Assignment No 1 Solution Fall 2020 Idea Solution

*************

Solution:

 

Question No 01 Solution

Part A:

for (i = 1 ; i<= n; i++)……n times

{

for (i = 1 ; i<= n2 ; i++)…….n2 times

{

for (i = 1 ; i<= n3 ; i++)……n3 times

{

a = x+y;……. Constant c

}

}

}

T(n)=n*n2*n3+c

T(n)=n6+c

T(n)=n6

 

Part B:

 

for ( y = 1 ; y <= n; i++)……n times

{

for (i = 1 ; i<= n2 ; i++)…….n2 times

{

for (i = 1 ; i<= n3 ; i++)……n3 times

{

a = x+y;……. Constant c

}

}

}



T(n)=n*n2*n3+c

T(n)=n6+c

T(n)=n6

 

Question No 02 Solution

matrix (int rows, int columns)

array matrix [rows][columns]

for i 1 to rows…….n times{

do for j 1 to columns…….n times{

do print Matrix[rows][columns]tab;

}

print endline;

T(n)=n*n=n2

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.