CS502 – Fundamentals of Algorithms
In CS502 Fundamentals of Algorithms we have you covered with Digitized Past Papers From Fall of Mid Term and Final Term.
NOTE: Tab/Click on Preparation Tab to take the MCQ’s Tests.
FINAL TERM
CS502_Finalallquizinonefile2013 View Download
CS502_FinalMCQS_big_file_of_ View Download
CS502_FinalMCQsbyM View Download
CS502_FinalMcqsforTermfaisal View Download
CS502_FinalReferenceSubjectives View Download
CS502_FinalSolvedMCQSwithreferencesbyAwais_2 View Download
CS502_FinalSolvedPapersMCQs View Download
CS502_Finalterm_Quiz_Solved_By_HunainRaza View Download
CS502_FinalTermSolvedMCQSAwais View Download
CS502_FinaltermsolvedMcqsMoaaz View Download
MID TERM
CS502_Mid_Mcqs_Ref_Moaaz View Download
CS502_Mid_Subj_Ref_Moaaz View Download
CS502_Mid_Dr_Tariq_Hanif View Download
CS502_Mid_MCQs_Mega_One1 View Download
CS502_Mid_Subje_by_Moaaz View Download
CS502_Finalallquizinonefile2013 View Download
CS502_FinalMCQS_big_file_of_ View Download
CS502_FinalMCQsbyM View Download
CS502_FinalMcqsforTermfaisal View Download
CS502_FinalReferenceSubjectives View Download
CS502_FinalSolvedMCQSwithreferencesbyAwais_2 View Download
CS502_FinalSolvedPapersMCQs View Download
CS502_Finalterm_Quiz_Solved_By_HunainRaza View Download
CS502_FinalTermSolvedMCQSAwais View Download
CS502_FinaltermsolvedMcqsMoaaz View Download
MID TERM
CS502_Mid_Mcqs_Ref_Moaaz View Download
CS502_Mid_Subj_Ref_Moaaz View Download
CS502_Mid_Dr_Tariq_Hanif View Download
CS502_Mid_MCQs_Mega_One1 View Download
CS502_Mid_Subje_by_Moaaz View Download
POSTED DATE:25-01-2019 IDEA SOLUTION
Question # 1:
Consider the following five matrices A, B, C, D and E along with their dimensions;
A B C D E
(6×5) (5×1) (1×7) (7×4) (4×2)
Determine the Optimal Multiplication Order for above matrices using Dynamic Programming approach and also present the sequence (i.e. optimal order) in Binary Tree.
Question # 2:
List down In and Out- Degrees of vertices of the given directed graph
Vertex | In Degree | Out Degree |
A | 3 | 2 |
B | 3 | 0 |
C | 2 | 1 |
D | 1 | 2 |
E | 0 | 4 |
- How many cycles are there in the given directed graph, list all of them. Further, is there any Hamiltonian cyclein it (yes/no)?
There is one cycles in this graph which are listed below.
- A.A
Hamiltonian Cycle = no
CS502– Practice Quiz 1
CS502– Practice Quiz 2
66. Compute the shortest-path weights bottom up FLOYD-WARSHALL(W, n)
Ref: Handouts Page No.161
Give a detailed example for 2d maxima problem
Answer: –
The problem with the brute-force algorithm is that it uses no intelligence in pruning out decisions. For example, once we know that a point pi is dominated by another point pj, we do not need to use pi for eliminating other points. This follows from the fact dominance relation is transitive. If pj dominates pi and pi dominates ph then pj also dominates ph; pi is not needed. Ref: Handouts Page No.17.
67. How the generic greedy algorithm operates in minimum spanning tree?
Answer: –
A generic greedy algorithm operates by repeatedly adding any safe edge to the current spanning tree. When is an edge safe? Consider the theoretical issues behind determining whether an edge is safe or not. Let S be a subset of vertices S _ V. A cut (S, V − S) is just a partition of vertices into two disjoint subsets. An edge (u, v) crosses the cut if one endpoint is in S and the other is in V − S. Given a subset of edges A, a cut respects A if no edge in A crosses the cut. It is not hard to see why respecting cuts are important to this problem. If we have computed a partial MST and we wish to know which edges can be added that do not induce a cycle in the current MST, any edge that crosses a respecting cut is a possible candidate.
Ref: Handouts Page No.143