Recursive branching
Count grid paths with blocked cells
Write a recursive method that counts ways to move right or down through a grid while avoiding blocked cells and stopping cleanly at boundaries.
Advanced Topics in Computer Science
Students learn to solve problems by defining smaller versions of the same problem, then reason about call stacks, base cases, and recursive correctness.
Unit Focus
The unit turns recursion from a mysterious trick into a reliable design pattern for strings, arrays, linked structures, trees, and backtracking.
Practice Work
Build recursive solutions for palindrome checks, binary search, and nested folder traversal.
Implement a small backtracking puzzle solver with trace output.
DSA Assignment Bank
Code Scholars provides structured assignments, implementation support, edge-case review, and runtime analysis coaching so students learn the concept rather than only memorizing a solution.
Recursive branching
Write a recursive method that counts ways to move right or down through a grid while avoiding blocked cells and stopping cleanly at boundaries.
Backtracking
Generate all strings with n pairs of matched symbols, using counts of opened and closed symbols to prevent invalid prefixes.
Recursive search
Given a set of valid words, decide whether a string can be split into valid pieces and explain where repeated subproblems appear.
Include or exclude recursion
Given an array of positive integers, recursively choose or skip each value and collect subsets whose sum equals a target.
Divide and conquer
For a sorted array, trace the low, high, and mid values for binary search and explain the base case for a missing target.
Two-pointer recursion
Check whether a phrase is a palindrome after ignoring spaces and case, without creating a full reversed copy.
Flood fill
Use recursion to count connected land regions in a small grid, marking cells safely so the same cell is not counted twice.
Backtracking with visited state
Return one path through a maze from start to finish, using a visited grid to prevent cycles.
Recursive construction
Given digits mapped to letters, recursively generate all possible letter strings and explain the branching factor.
Recursive structure
Given a simplified nested-list object, compute its maximum depth and describe the result for an empty nested list.
Recursive pointer update
Reverse a singly linked list using recursion and explain which reference becomes the new head.
Tree recursion
Traverse a binary tree recursively and append values to a list in preorder while preserving the original tree.
Constrained recursion
Generate all length-k increasing sequences from 1 to n and prune choices that cannot complete the sequence.
Optimal substructure
Given a grid of nonnegative costs, recursively compute the cheapest path to the bottom-right using only right and down moves.
Recurrence design
Count ways to reach step n using steps of size 1, 2, or 3, and identify why a plain recursive solution repeats work.
String recursion
Compress consecutive characters into character-count groups using recursion over the current index and run length.
Recursive state tracking
Determine whether an array can be split into two groups with equal sum by recursively assigning each value to one side.
Recursive comparison
Compare two strings recursively and return the first index where they differ, including behavior when one string ends first.
Backtracking and swapping
Generate all permutations of distinct values using in-place swaps, then restore the array after each recursive call.
Backtracking with duplicate control
Modify permutation generation so duplicate input values do not produce duplicate output arrangements.
Tree recursion
Given a binary expression tree, recursively evaluate operators and operands while rejecting malformed operator nodes.
Divide and conquer
Split an array into halves, find a candidate in each half, and verify which candidate appears most often.
Memoized recursion
Given a DAG, recursively count paths from a start node to an end node and explain why memoization is safe.
Recursive parsing
Expand a small pattern such as repeated grouped text by recursively processing bracketed sections.
Pruned recursion
Generate lexicographic strings over a small alphabet, but skip whole branches when their size is smaller than k.
Flood fill boundaries
Recolor a connected region in a matrix and explain the four checks needed before each recursive call.
Constraint search
Assign students to limited project teams recursively while respecting capacity and prerequisite constraints.
Call-stack reasoning
Given a recursive method that returns a value after two calls, draw the call tree and compute the final return value.
Stack simulation
Rewrite a recursive depth-first traversal using an explicit stack and compare the order of processing.
Concept support
Create a multi-part assignment that asks students to trace, implement, test, and analyze one recursive problem.
Work through the concepts, code, edge cases, and runtime analysis with 1:1 guidance.