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

CS502 Mid Term Papers Fall 2017 December 9, 2017 to December 20, 2017 & Past Papers + 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: 4170

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

### Replies to This Discussion

CS502
1) differences between program and algorithm
2) how bubble sort works?
3) Matrix chain wala tha..
. code completed karna tha..1st 5 line missing thi es ma se
MATRIX-CHAIN(p,N)
1 for i = 1,N
2 do m[i, i] 0
3 for L = 2,N
4 do
5 for i = 1, n − L + 1
6 do j i + L − 1
7 m[i, j] 1
8 for k = 1, j − 1
9 do t m[i, k] +m[k + 1, j] + pi−1 · pk · pj
10 if (t < m[i, j])
11 then m[i, j] t; s[i, j] k

4) code maxima wla tha or use converted karna tha.. ya
MAXIMA(int n, Point P[1 . . . n])
1 for i 1 to n n times
2 do maximal true
3 for j 1 to n n times
4 do
5 if (i 6= j)&(P[i].x P[j].x)&(P[i].y P[j].y) 4 accesses
6 then maximal false break
7 if maximal
8 then output P[i].x, P[i].y 2 accesses

Amal Hanif thanks for sharing first iteration of quicksort was to be found.

find the faster function (asymptotic notation.)

find edit distance of two words.

how selection problem works.

complete plane-sweep algorithm.

most mcqs were from asymptotic notation chapter.

19 mcqs 5 qs( 2 x 3 marks, 3 x 5 marks )

1.       Identify the maximal points (the points that are NOT dominated by other points) in the given set according to 2-D maxima problem.

{ (2,5) , (4, 4) , (4,11) , (5,1) , (7,7) , (7,13) , (9,10) , (11,5) , (12,12), (13,3) , (14,10) , (15,7)}

2.       Show that any sorting algorithm that uses only comparison among elements requires comparisons. Remember comparisons among elements require at least (log n!) comparisons in the worst case

3.       Illustrate how Counting Sort works on array

A= 7, 1, 4, 1, 2, 4, 5, 7, 2, 0, 8

CS502 - Fundamentals of Algorithms

My Todays Paper at 12:30pm in Lahore Campus.

• 11 MCQS from past papers.

• 7 MCQS was conceptual but easy.

• What is necessary assumption for average-case analysis of Quick sort? 3 marks

• Write the experimental elements of algorithm? 3 marks

• Write Down the steps of Dynamic programming? 5 marks

• Complete the following algorithm: 5 marks
HEAPIFY( array A, int i, int m)
1 l LEFT(i)
2 r RIGHT(i)
3 max i
4 if (l _ m)and(A[l] > A[max])
5………
6………
7………
8………
9………
10……

• Last question was conceptual so thats why didn't remember. 5 marks

Q1   Complete these blanks  it  (5)

HEAPIFY( array A, int i, int m)

1 l←LEFT(i)

2 r←RIGHT(i)

3 max←i

4 if (l ≤ m)and(A[l] > A[max])

5 then max←l

6 ---------------------if (r ≤ m)and(A[r] > A[max])

7--------------------- then max←r

8------------------------------------ if (max 6= i)

9 ----------------------------then SWAP(A[i],A[max])

10------------------------ HEAPIFY(A,max,m)

Q2   Write the properties of algorithm (5)

Q3  Which one is best  multiplication for these matrices  where  A1 is 5×7,  A2 is 7×8  and A3 is 8×5           (5marks)

1. ((A1A2)A3)
2. (A1(A2A3))

Q4) Write first three steps in Sieve selection   3marks

Q5)  Write heap sort algorithm   3marks

Aur 8 MCQS  DR Hanif  or moaaz s aiy thy

.