This project started as my third assignment for Advanced Programming. It contains four independent C++ programs built around recursive problem solving, from recursive string construction to backtracking and graph traversal.
| Program |
Problem |
Approach |
Q1 |
Generate a nested LaTeX fraction for a given depth |
Recursive tree construction |
Q2 |
Distribute gifts through a royal family according to age and seating rules |
Recursive simulation |
Q3 |
Select the most valuable discounted meal without exceeding the discount cap |
Backtracking and subset search |
Q4 |
Find the largest connected territory for each empire on a map |
Recursive flood fill |
- Four independent command-line programs
- Recursive solutions for each core algorithm
- Exact integer calculation for tax and discount limits
- Backtracking over menu combinations
- Grid traversal through land, ports, and sea routes
- C++20 build configuration for all programs
| Path |
Responsibility |
src/Q1.cpp |
LaTeX fraction program entry point |
src/latex_fraction.hpp, src/latex_fraction.cpp |
Recursive fraction generation |
src/Q2.cpp |
Royal gift distribution program entry point |
src/royal_eidi.hpp, src/royal_eidi.cpp |
Recursive gift simulation |
src/Q3.cpp |
Meal optimization program entry point |
src/meal_optimizer.hpp, src/meal_optimizer.cpp |
Discount-aware subset optimization |
src/Q4.cpp |
Empire map program entry point |
src/empire_map.hpp, src/empire_map.cpp |
Recursive territory exploration |
Makefile |
C++20 build configuration |