chapter

    Recursion and Backtracking Short Notes for Cmi M.sc. and Ph.d. Computer Science

    Recursion and Backtracking short notes for CMI M.Sc. and Ph.D. Computer Science: 21 study cards covering concepts, formulas, shortcuts and exam traps, plus so

    Recursion and Backtracking short notes

    If You See This Do This

    Triggers
    If you seeDo this
    Recursive function definitionIdentify the base case and the recursive step
    Missing base caseAdd a condition that returns a value without calling the function
    State not shrinkingEnsure the argument strictly decreases in size or value
    Multiple recursive callsTrace each branch independently before combining results
    Return value ignoredEnsure the recursive call is part of an expression or assignment

    Formulas and Their Limits

    Validity
    FormulaValid whenBreaks when
    decreases by 1 each step decreases by a fraction or different amount
    and or is negative without handling
    Base case The reduction step guarantees reaching a value less than The reduction step skips over the base case values

    Three Second Sanity Checks

    Checks
    CheckEliminates
    Limiting case: Base case input must match the base case return valueOptions adding extra terms
    Dimension: Argument size must strictly decrease with every recursive callOptions with constant or increasing arguments
    Sign: Return type must match the expected output type for both base and recursive casesOptions mixing types
    Symmetry: Commutative operations must not change the final result based on orderOptions dependent on evaluation order

    18 more cards in this chapter

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Recursion and Backtracking Short Notes for CMI M.Sc. and Ph.D. Computer Science

    Recursion and Backtracking short notes for CMI M.Sc. and Ph.D. Computer Science: 21 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    If You See This Do This

    Triggers
    If you seeDo this
    Recursive function definitionIdentify the base case and the recursive step
    Missing base caseAdd a condition that returns a value without calling the function
    State not shrinkingEnsure the argument strictly decreases in size or value
    Multiple recursive callsTrace each branch independently before combining results
    Return value ignoredEnsure the recursive call is part of an expression or assignment

    Formulas and Their Limits

    Validity
    FormulaValid whenBreaks when
    decreases by 1 each step decreases by a fraction or different amount
    and or is negative without handling
    Base case The reduction step guarantees reaching a value less than The reduction step skips over the base case values

    Three Second Sanity Checks

    Checks
    CheckEliminates
    Limiting case: Base case input must match the base case return valueOptions adding extra terms
    Dimension: Argument size must strictly decrease with every recursive callOptions with constant or increasing arguments
    Sign: Return type must match the expected output type for both base and recursive casesOptions mixing types
    Symmetry: Commutative operations must not change the final result based on orderOptions dependent on evaluation order

    If You See This Do This

    If You See This Do This
    If you seeDo this
    Maximum recursion depthCount the initial call frame plus all recursive calls
    Stack overflow errorReduce recursion depth or increase stack size limit
    Tail recursion optimizationReuse the current stack frame instead of pushing a new one
    Local variable scope in recursionEach frame has its own independent copy

    More short notes in this unit