DEPARTMENT OF COMPUTER SCIENCE & SOFTWARE ENGINEERING CS-101 • Academic Year 2024-2025
Computer Science & Algorithmic Analysis: Core Concepts Workshop
& Practice Problems [Comprehensive Study Guide & Solutions]
Module Focus: Dynamic Programming, Memoization & Greedy Paradigms | Total Items: 15 | Academic Term: Academic Year 2024-2025
UNIT CONCEPTUAL OVERVIEW & STUDY OBJECTIVES:
St
...[Show More]
DEPARTMENT OF COMPUTER SCIENCE & SOFTWARE ENGINEERING CS-101 • Academic Year 2024-2025
Computer Science & Algorithmic Analysis: Core Concepts Workshop
& Practice Problems [Comprehensive Study Guide & Solutions]
Module Focus: Dynamic Programming, Memoization & Greedy Paradigms | Total Items: 15 | Academic Term: Academic Year 2024-2025
UNIT CONCEPTUAL OVERVIEW & STUDY OBJECTIVES:
Study each theoretical derivation, proof sketch, and algorithmic trace to prepare for departmental midterm
assessments, technical coding rounds, and graduate entrance evaluations.
Study Guidance: Review each prompt carefully. Detailed theoretical explanations accompany each item below
to reinforce analytical understanding and prepare for comprehensive examinations.
1. Critically analyze and evaluate: Explain the operation of Counting Sort and why it beats the O(n log n)
comparison barrier.
Detailed Solution & Theoretical Analysis:
Comparison-based sorts (quicksort, mergesort) are mathematically proven to requir
decision tree lower bounds. Counting sort operates without comparisons by tallying frequencies of integer keys within a
bounded range [0, k], running in O(n + k) linear time and stable order.
2. Analytical Question: What is Amortized Analysis? Illustrate using dynamic array resizing.
Detailed Solution & Theoretical Analysis:
Amortized analysis averages the running time of a sequence of operations over all operations performed, showing that
occasional expensive operations do not compromise overall efficiency. In a dynamic array that doubles capacity when
full, copying n elements takes O(n) time, but occurs only every n operations, yielding an amortized O(1) constant time
per append.
3. Provide a detailed analytical exposition addressing: explain how Hash Collisions are resolved via
Separate Chaining versus Open Addressing.
Detailed Solution & Theoretical Analysis:
Separate Chaining stores colliding elements in a secondary linked list or balanced red-black tree at the bucket index,
exhibiting smooth degradation under high load factors. Open Addressing probes alternate slots directly within the table
array (linear probing, quadratic probing, or double hashing), eliminating pointer overhead but suffering from primary
and secondary clustering as load factor approaches 1.
4. Examine the primary mechanisms, assumptions, and institutional impact of: explain the mechanics
and path-compression optimization of Disjoint-Set Union (DSU / Union-Find).
Detailed Solution & Theoretical Analysis:
DSU manages partitioned sets with two primary operations: Find (identifies representative set root) and Union (merges
two sets). Path compression flattens tree depth during Find by linking traversed nodes directly to the root; union by
rank attaches shallower trees beneath deeper roots. Together, they achieve near-c
operational time (inverse Ackermann function).
[Show Less]