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

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# Assignment no 1 CS502 Fundamentals of Algorithms

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

Due Date:19/05/2016

Instructions

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>

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

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 12684

.

+ 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

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

thnx wasfa

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:

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

## Latest Activity

+! Rob liked + "αяsαℓ " Ќąƶµяɨ •"'s discussion میرا پیارا وطن برا نہیں ہے
20 minutes ago
Cisco updated their profile
1 hour ago
akshay updated their profile
1 hour ago
Mustafa updated their profile
1 hour ago
2 hours ago
Somia shared + M.Tariq Malik's discussion on Twitter

### My Helping Hands

2 hours ago
Somia liked + M.Tariq Malik's discussion My Helping Hands
2 hours ago
Kinza Mubasher liked + M.Tariq Malik's discussion My Helping Hands
3 hours ago
ateeqa and aqsa iqbal joined Virtual University of Pakistan
3 hours ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion My Helping Hands
3 hours ago
+ M.Tariq Malik posted a discussion

3 hours ago
5 hours ago

1

2

3