Dear VU (Virtual University of Pakistan) Students, here you can read or Download

**CS502 - Fundamentals of Algorithms**Assignment**No 1 Solution**and Discussion of Semester**Spring 2018**. Assignment Due Date is**10**MAY, 2018. Total Marks are**20**. This assignment covers lesson no. 1-7. We are here to facilitate your learning and we do not appreciate the idea of copying or replicating solutions. You can also like for latest update our Facebook page, YouTube channel and follow on Google+.

**Objectives of this assignment are:**

- To understand line by line analysis of an algorithm
- To understand how to calculate running time of an algorithm
- To perform comparison of different algorithms

**Assignment Instructions:**

- The assignment will not be accepted after due date.
- Zero marks will be awarded if the assignment does not open or the file is corrupt.
- The assignment file must be an MS Word (.doc/.docx) file format; Assignment will not be accepted in any other format.
- Zero marks will be awarded if assignment is copied (from other student or copied from handouts or internet).
- Zero marks will be awarded if Student ID is not mentioned in the assignment file.

For any query about the assignment, contact only at

**CS502@vu.edu.pk**Please do not post queries related to assignment on MDB.

**Question No.1**:

For the following code segment, provide line-by-line analysis and construct function T(n) that give the runtime of this code as a function of "n". Also determine the big-O for this code segment. [Marks: 5+3+2]

**Question No.2**:

Which of the following two functions is faster?

a) f1 = 10n2

b) f2 = n3

**Question No.3:**

In the context of 2D Maxima problem, Brute Force algorithm runs in Θ(n2) time and Plane-Sweep algorithm runs in Θ(nlog2n) time. For n = 500,000, if Plane-Sweep takes 1 second, how much time (in hours) Brute Force algorithm will take? Calculate and show all the steps.

**Note:**Base of log is 2 (e.g. log210 = 3.321928095)

**Download Assignment Solution File:**

Download CS502 Assignment Solution by Clicking the Download Button Below in just single Click

You can Also Download Midterm Solved Past Papers referenceby Moaaz and Waqar Sidhu, Final term Solved Past Papers reference by Moaaz and WaqarSidhu, GDB Solutions, Assignment Solutions, and Solved Quizzes files, PPTSlides, Handouts, Final term Short Notes, Mid Term Short Notes and NTS Guidelines.