We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>


Looking For Something at vustudents.ning.com? Click Here to Search

Assignment No. 01
Semester: Spring 2016
CS502: Fundamentals of Algorithms
Total Marks: 20

Due Date:19/05/2016

Instructions
Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted assignment is other than .doc file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from any other source).

Objective

The objective of this assignment is to:

 Learn and practice Algorithm running time analysis
 Solve recurrences using iteration method

Submission

You are required to submit your solution through LMS as MS Word document.

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

Question 1:
Analyze the running time complexity of the following piece of code. Show your working step by step.

SumOddEven(A,n) //A is array and n is size of array
{
int count, sum;
for(int i = 1; i<=n; i++) { sum_even=0; sum_odd=0; for(int j = i; j<=n; j++) { if (A[j] Mod 2 == 0) //check if number is even sum_even=sum_even+A[j] //Sum even numbers else sum_odd=sum_odd+A[j] //Sum odd numbers } cout/p>

+ Click Here To Join also Our facebook study Group.

..How to Join Subject Study Groups & Get Helping Material?..


See Your Saved Posts Timeline

Views: 12636

.

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

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

Attachments:

Replies to This Discussion

Thanks

yr full solution file send karo

wasfa ny full hi solution send kia almost first question wrong krny sy better tha jo proper method usko solve krny ka bus wohi wasfa ny share kia hy .... :)

in Question 1 They Asked about Time Complicity LOL what did u do in Solution
This Answer is also Wrong

analysis ki jga,,,complexity likh lo... :P

thnx wasfa

I Got Final Answer After Admin Warn me on FaceBook Programming Group

what's the final answer then?

hey agr meri assignmnt rong hui to plzzz mje BadDuaen na dena..bcz mje cnfrm ni abt my assignmnt,,jo smjh i bna li :(

idea sol Q.1

Attachments:

Yeah This is Right Answer

for(int j = i; j<=n; j++) yaha p n+1 time chaly ga ek time n k leye ek time condition false k leye

RSS

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

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