CS502 SOLVED SUBJECTIVE FOR FINAL TERM.doc
Verified academic study resource for CS502 (Fundamentals of Algorithms) under the Computer Science at Virtual University of Pakistan. This DOC document (Final-Term Solved Past Paper & Examination Pack) covers Final-Term Exam Scope (Lectures 23 to 45) spanning approximately 320 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.
- Course
- CS502 – Fundamentals of Algorithms
- Faculty
- Computer Science
- Format
- DOC
- Type
- Final-Term
- Coverage
- Final-Term Exam Scope (Lectures 23 to 45)
- Tags
- SUBJECTIVE, SOLVED, FINALTERM
Virtual University regulations strictly require achieving at least 20% marks in the Final-Term exam paper alone (typically 12+ marks out of 60) to pass CS502, regardless of midterm scores.
What this file covers — CS502 syllabus roadmap
- Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
- Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
- Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
- Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)
Frequently asked questions
Where can I download CS502 SOLVED SUBJECTIVE FOR FINAL TERM.doc for free?
You can preview and download "CS502 SOLVED SUBJECTIVE FOR FINAL TERM.doc" (CS502 DOC, ~320 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs502-solved-subjective-for-final-term-doc) with 100% free high-speed downloads and zero registration requirements.
What syllabus chapters and lectures are covered in this CS502 file?
This document covers Final-Term Exam Scope (Lectures 23 to 45) across 4 distinct lecture units (Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.
What is the passing criteria for CS502 under the VU 20% Two-Half Rule?
Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.
Are CS502 solved past papers and handouts verified for 2026 exams?
Yes. All CS502 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.
Inside this file
CS502
SOLVED SUBJECTIVE
FINAL TERM
1) In strong components problem what complete refers to?
Ans: Complete in the sense that that it is possible from any location in the network to reach any other location in the digraph.
2) How shortest path information is propagated in graph using Bell-Ford algorithm?
ANS. Bellman-Ford algorithm, solves the single-source shortest-paths problem allow negative-weight edges in the in-put graph and produce a correct answer as long as no negative-weight cycles are reachable from the source. Bellman-ford is based on performing repeated relaxation .Bellman ford applies relaxation to every edge of the graph and repeats this V-1 times.
3) How can we make it possible for an array of “n” elements that every element has equal probability of ‘1/n’ to be selected as pivot elements?
4) Define according to KrusKal” s algorithm
a) Create set(u) create a set containing a single item u.
b) Find set(u) Find the set that contains u
c) Union (u, v) merge the set containing u and set containing v into a common set.
5) Write the indicates that the graph is complete?
Ans: Acomplete graphis an undirected graph in which every pair of vertices is adjacent
6) What is the recurrence relation for binary search and give some details for it and write asymptotic analysis at end?
7) Prove the Lemma:
Consider a diagraph G = ( V,E ) and any DFS forest for G. G has a cycle if and only if the DFS forest has a back edges ?
Ans: If there is back edge (u,v) then v is an ancestor of u and by tree edges from u to v we get a cycle . we show the contra positive suppose there are no back edges .by the lemma above each of the remaining types of edges ,tree, forward and cross all have the property that they go from vertices with higher finish time to the vertices with lower finish time .thus along any path finish times decrease monotonically implying there can be no cycle.
Difference b/w back ward and forward 2 marks
Ans Back edges are those edges.(u,v) where v is an ancestor of u in a depth-first tree. .
. Forward edges are those non tree edges.(u,v) where v is a proper descendant of u in a depth-first tree.
Polynomial time algorithm 2 marks
ANS:A polynomial time algorithm is any algorithm that runs in o(n k) time .A problem is solvable in polynomial time if there is a polynomial time algorithm for it.
Describe Minimum Spanning Trees Problem with examples. 2 marks
ans; A common problem is communications networks ans circuit design is that of connecting together a set of nodes by network of total minimum length .The length is the sum of lengths of connecting wires. the computational problem is called minimum spanning tree(MST) problem. A MST is a tree of minimum weight.
3n^2+7n-12 ke lower or upper bound solve kana tha 3 marks
Code of fib memorization . 3 marks
Ans. FIB(n)
1 if (n < 2)
2 then return n
3 else return FIB(n − 1) + FIB(n − 2)
write iterative dfs lgorithm?5 marks
ans ITERATIVE DFS(s)
1 PUSH(s)
2 while stack not empty
3 do v ← POP()
4 if v is unmarked
5 then mark v
6 for each edge (v, w)
7 do PUSH(w)
Q No.1 Suppose you could prove that an NP-complete problem can not be solved in polynomial time. What would be the consequence?
Ans: The importance of NP-complete problems should now be clear. If any NP-complete problem is solvable
in polynomial time, then every NP-complete problem is also solvable in polynomial time. Conversely, if
we can prove that any NP-complete problem cannot be solved in polynomial time, the every
NP-complete problem cannot be solvable in polynomial time.
Q No.2 Let the adjacency list representation of an undirected graph is given
below. Explain what general property of the list indicates that the graph
has an isolated vertex.
a b c e b a d c a d e f
d b c f e a c f f c d e g
Q No.3 What are two cases for computing?
ANS
Describe Dijkstra's algorithm working?
ANS: Dijkstra’s algorithm works on a weighted directed graph G = (V, E) in which all edge
weights are non-negative, i.e., w(u, v) _ 0 for each edge (u, v) 2 E.
Q No.4 The following adjacency matrix represents a graph that consists of four
vertices labeled 0, 1, 2 and 3. The entries in the matrix indicate edge
weights.
0
1
2
3
0
0
1
0
3
1
2
0
4
0
2
0
1
0
1
3
2
0
0
0
ANS: NO. Because number of rows and number of columns are always same
Q No.5 In the solution of edit distance technique, please describe two solution
given (i) MATHS (ii) ARTS
ANS:
Q No.6 Variants of shortest path solution briefly?
ANS: There are a few variants of the shortest path problem.
Single-source shortest-path problem: Find shortest paths from a given (single) source
vertex s 2 V to every other vertex v 2 V in the graph G.
Single-destination shortest-paths problem: Find a shortest path to a given destination
vertex t from each vertex v. We can reduce the this problem to a single-source problem
by reversing the direction of each edge in the graph.
Single-pair shortest-path problem: Find a shortest path from u to v for given vertices u
and v. If we solve the single-source problem with source vertex u, we solve this problem
also. No algorithms for this problem are known to run asymptotically faster than the
best single-source algorithms in the worst case.
All-pairs shortest-paths problem: Find a shortest path from u to v for every pair of
vertices u and v. Although this problem can be solved by running a single-source
algorithm once from each vertex, it can usually be solved faster.
Ref: Handouts Page No.153
Q No.7 Explain the following two basic cases according to Floyd-Warshall Algorithm,?
ANS There are two basic cases:
1. Don’t go through vertex k at all
Then the shortest path from i to j uses only intermediate vertices {1, 2, . . . , k − 1}. Hence the length of the shortest Is d (k-1) ij
2. Do go through vertex k.
First observe that a shortest path does not go through the same vertex twice, so we canMore CS502 files
- All Subjects Mid & Final 25000 Pdf Files.pdf (PDF · Final-Term)
- CS502 - FINAL TERMA SUBJECTIVE SOLVED WITH REFERENCE.doc (DOC · Final-Term)
- CS502 - Final term solved Mcqs with references by Moaaz.doc (DOC · Final-Term)
- CS502 - Final term solved Mcqs with references by Moaaz.pdf (PDF · Final-Term)
- CS502 - Final term solved Subjective with references by Moaa (DOC · Final-Term)
- CS502 - Final term solved Subjective with references by Moaa (PDF · Final-Term)
- CS502 FINAL SEP.pdf (PDF · Final-Term)
- CS502 FINAL TERM CURRENT PAPER 2022 SOLVED BY PRNCE ALVI.pdf (PDF · Final-Term)