Skip to content

Conversation

@PavitraPi
Copy link

@PavitraPi PavitraPi commented Nov 16, 2025

What's Included

1. New Algorithm Modules

algorithms/hanoi.typ

Formal recursive definition with binary branching structure.
Mapcode-style specification (rho, F, pi).
Concrete computation for a sample instance (3 disks, A→C using B).
Full state-space visualization using the project's mapcode-viz framework.
Structured layout for disk configurations, move sequences, and stepwise evaluation showing the two recursive subproblems per call.

algorithms/coinChange.typ

Formal DP recurrence definition with multi-way branching (one branch per coin).
Mapcode-style specification (rho, F, pi).
Concrete DP computation for a sample instance (amount=11, coins={1,3,4}).
Full DP-table visualization using the project's mapcode-viz framework.
Structured layout for amount-to-coins mapping, tensor updates, and stepwise evaluation demonstrating recursive branching.

2. Documentation Integration

Updated main.typ:

Added #include "algorithms/tower-of-hanoi.typ" after the existing algorithms section.
Added #include "algorithms/coin-change.typ" after the Tower of Hanoi section.
Ensures both chapters appear in output in correct sequence.

Why This Matters

Brings two classical recursive algorithms into the mapcode framework with distinct recursion patterns:

Tower of Hanoi: Binary recursion with two recursive calls per invocation
Coin Change: Multi-way branching with |coins| recursive calls per state

Demonstrates non-trivial recursion structures useful for debugging the mapcode-viz pipeline.
Provides examples of both divide-and-conquer (Hanoi) and dynamic programming (Coin Change) paradigms.
Serves as templates for future recursive algorithm additions.

Files Changed

algorithms/hanoi.typ — 138 lines added
algorithms/coinChange.typ — 119 lines added
main.typ — 4 lines added

No existing code modified; additions are isolated and non-breaking.

Checklist

✓ Builds successfully
✓ Renders correctly in main.typ
✓ Follows repository style and structure
✓ Demonstrates non-trivial recursion (≥2 branches)
✓ No backward-incompatible changes

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant