0% found this document useful (0 votes)
47 views2 pages

O o o O: The Objective of This Assignment Is To

The document provides instructions for Assignment 01 for the course CS502: Fundamentals of Algorithms. It states that the assignment is due on May 19, 2016 and must be submitted as a .doc file through the LMS. It will receive zero marks if submitted late, in the wrong file format, or contains plagiarized content. The objective is to learn algorithm time analysis and solve recurrences using iteration. Students should contact the provided email with any questions.

Uploaded by

Shahbaz Sharif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views2 pages

O o o O: The Objective of This Assignment Is To

The document provides instructions for Assignment 01 for the course CS502: Fundamentals of Algorithms. It states that the assignment is due on May 19, 2016 and must be submitted as a .doc file through the LMS. It will receive zero marks if submitted late, in the wrong file format, or contains plagiarized content. The objective is to learn algorithm time analysis and solve recurrences using iteration. Students should contact the provided email with any questions.

Uploaded by

Shahbaz Sharif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No.

01 Total Marks: 20
Semester: Spring 2016

CS502: Fundamentals of Algorithms


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 [email protected]

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<<sum_even;

cout<<sum_odd;

Question 2:

Solve the following recurrence relation using iterative method and give answer at the end in
asymptotic form (show all possible steps).

You might also like