CSS Computer Science (Optional) — Paper-I, Section-B, Topic IV. This is the first year this page has been compiled — all 4 question-patterns below are freshly extracted from the CSS Computer Science Paper-I 2026 exam (the earliest Section-B past paper reviewed for this project so far). More patterns will be added here as further years' Section-B papers are reviewed.

Q1. Why Binary Search Fails on an Unsorted List

Appeared: 2026, Q5(a)

Why is Binary Search not suitable for an unsorted list?

Solution:

Binary Search works by repeatedly comparing the target with the middle element and eliminating one half of the remaining search space — but that elimination step is only valid if the array is sorted, since it relies on the assumption that everything to one side of the midpoint is smaller (or larger) than the midpoint itself. On an unsorted list, the target could be anywhere regardless of how it compares to the midpoint, so discarding a half based on that comparison can wrongly throw away the region that actually contains the target — the algorithm can return "not found" even when the value is present.


Q2. Time Complexity vs Space Complexity (with Examples)

Appeared: 2026, Q5(b)

What is the difference between Time Complexity and Space Complexity? Explain with examples.

Solution:

Aspect Time Complexity Space Complexity
Measures How the running time grows as input size n grows How much additional memory is needed as n grows
Expressed as Big-O notation, e.g. O(n), O(log n), O(n²) Big-O notation over memory units, e.g. O(1), O(n)
Includes Comparisons, loop iterations, recursive calls Auxiliary variables, extra data structures, recursion call-stack frames

Example 1 — Linear Search: Time O(n) (may check every element in the worst case); Space O(1) (only a loop index/counter is needed, no extra structures).

Example 2 — Merge Sort: Time O(n log n); Space O(n) (needs an auxiliary array to merge the two halves back together — unlike in-place Quick Sort).

Example 3 — Recursive Factorial(n): Time O(n); Space O(n) — each recursive call pushes a new stack frame, so space grows with recursion depth even though the algorithm creates no explicit array.

Key reasoning point: a fast algorithm (low time complexity) can still be memory-hungry (high space complexity), and vice versa — the two must always be evaluated independently; a common examiner trap is testing whether a candidate conflates "efficient" with only one of the two.