We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>
CS502 Assignment No. 02 Solution & Discussion Due Date: Dec 07, 2015
Assignment No. 02
CS502: Fundamentals of Algorithms
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
The objective of this assignment is to enable students:
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
Consider the following recursive algorithm for computing the sum of the first n squares:
Sum(n) = 12 + 22 + . . . + n2.
if n = 1 return 1
else return SUM(n − 1) + n ∗ n
Write recurrence relation for above algorithm and solve it using Iteration Method.
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.
.+ 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)
ye kis question ka solution hy /
y thk h??
is this correct Ahmad MIT's assignment guyssssssssss
tehk he hoge ab to submit be krva di
pata nh thk h b ya nh
kaun si submit ki share hi kar do
submit karain assignment sol
ya corrct h ya phly wali
Slove of Question 2 divide and conquer technique
Algorithm to find minimum number
If (p=r) // here we supposing n is equal to one
Then return A[p]
Else <-- Choose_Pivot (A, p, r) //if n is not equal to 1 then select a pivot
q <-- Partition (A, p, r, x) ...................//then divide the array
if rank_x= 1 ................../// if the rank of pivot element after partition is 1
then return x ... //then this pivot element is the minimum number in array
else //if rank_x > 1 //// otherwise proceed recursively
then return Select( A, p, q-1, 1)
thanks to zain in for guidance