We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.
+ Link For Assignments, GDBs & Online Quizzes Solution 
+ Link For Past Papers, Solved MCQs, Short Notes & More 
CS502 Assignment No. 02 Solution & Discussion Due Date: Dec 07, 2015
Assignment No. 02 CS502: Fundamentals of Algorithms Due Date:07/12/2015 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:
Objective
The objective of this assignment is to enable students:
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:
Consider the following recursive algorithm for computing the sum of the first n squares: Sum(n) = 12 + 22 + . . . + n2.
Algorithm: SUM(n) if n = 1 return 1 else return SUM(n − 1) + n ∗ n
Write recurrence relation for above algorithm and solve it using Iteration Method.
Question 2:
In Divide and conquer strategy, three main steps are performed:
Write an algorithm to find minimum number from a given array of size ‘n’ using divide and conquer approach.


Lectures Covered: This assignment covers first 15 Lectures. Deadline: Your assignment must be uploaded/submitted at or before 07 Dec, 2015. 
Tags:
+ 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)anyone plssssssssssssssssssss share your complete solution here....
solution plz
koi 2 question ka idea b de den plz
def find_min(arr):
""" Return the least number in nonempty list `arr`.
"""
len_arr = len(arr)
assert len_arr > 0
# Base case:
if len_arr == 1:
return arr[0]
# Divide...
mid = len_arr // 2
# floor of len_arr/2; thus, mid ≥ 1
m1 = find_min(arr[0:mid])
m2 = find_min(arr[mid:len_arr])
# ... and conquer:
return min(m1,m2)
kya yh thek hy???
Important Announcement Regarding Assignment 2 Due Date Dated: Dec 07, 15
Dear Students,
This is to inform you that Deadline of Assignment 2 submission has been extended to 08122015.
By considering your problems in solving Assignment 2, we are going to conduct tomorrow’s (08122015) Adobe Connect Sessions on Assignment 2. If you are facing any difficulty to solve assignment, you are advised to attend the sessions. Detailed announcement on these sessions schedule has already been made on LMS.
In case of any query, you can contact at cs502@vu.edu.pk.
Good Luck!
Regards,
Instructor CS502
kindly koi to sol btaye.bht togh assignment h kch smj ni ara
idea
First of all, if n == 1 you should probably return 1. And yes, this recursive function computes 1 + 2^3 + 3^3 + ... + n^3. How do we know that?
Well, take an example like n = 5;
If you add them up => R(5) returns 5^3 + 4^3 + .. + 2^3 + 1.
EXPLANATION:
Denoting S(n) the sum of the first n cubes, S(n) must be a polynomial of the fourth degree in n, let
S(n) = an^4+bn³+cn²+dn.
This is because
1) S(0)= 0, so there is no independent term,
2) When computing S(n)S(n1), which must equal n³, you get a polynomial of the third degree, by cancellation of the quartic term:
S(n)S(n1) = a(n^4(n1)^4)+b(n³(n1)³)+c(n²(n1)²)+d(n(n1)).
Developing and simplifying,
a(4n³6n²+4n1)+b(3n²3n+1)+c(2n1)+d = n³.
Let us identify the coefficients:
n³: 4a =1
n²: 6a+3b =0
n: 4a3b+2c =0
1: a +b c+d=0
Solving this triangular system is straigthforward:
a=1/4
b=1/2
c=1/4
d=0.
and finally
S(n) = (n^4+2n³+n²)/4 = n²(n+1)²/4.
Check iteration method of power 2 k=log n
T(n) = 2kT (n/(2k)) + (n+n+n+....+n)
= n + n log n
see on page 31
Lecture number 8 the solution s given
EXAMPLE FROM BOOK:
plz guide us ya working to nahe karne
T(n) = 2kT(n/(2k)) + (n + n + n + · · · + n)  {z }
k times
= 2kT(n/(2k)) + kn
= 2(logn)T(n/(2(logn))) + (log n)n
= 2(logn)T(n/n) + (log n)n
= nT(1) + n log n = n + n log n
bot easy assignment ha i done :D
plz give me solution
S.A please help me aj last date hai
Solution
SEe Aach file
© 2020 Created by +M.Tariq Malik. Powered by
Promote Us  Report an Issue  Privacy Policy  Terms of Service
We are usergenerated contents site. All product, videos, pictures & others contents on vustudents.ning.com don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com or Contact us at contact Page with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List  Moderators Group
All Members  Featured Members  Top Reputation Members  Angels Members  Intellectual Members  Criteria for Selection
Become a Team Member  Safety Guidelines for New  Site FAQ & Rules  Safety Matters  Online Safety  Rules For Blog Post