A web-based study planner that uses Dynamic Programming (0/1 Knapsack) to optimize a studentโs study schedule for maximum exam marks under limited study hours.
Link: https://dynamic-program.vercel.app/
Features:
- Add topics with time required and expected marks
- Set study constraints (days & hours/day)
- Click Optimize Study Plan to get:
- Maximum achievable marks
- Topics to focus on
- Hours used
- DP Table Visualization showing step-by-step computation
Students often struggle to decide what topics to focus on when time is limited.
This project models the problem as a 0/1 Knapsack problem:
- Capacity: Total available study hours
- Items: Syllabus topics
- Weight: Time required per topic
- Value: Expected marks per topic
The goal is to maximize marks without exceeding available hours.
- Frontend: React + Vite
- Styling: Tailwind CSS
- Logic: JavaScript (Dynamic Programming)
- No database required (state is in-memory)
- Topic Input
- Name, Time required (hours), Expected Marks
- Constraints Input
- Days before exam, Hours per day
- Optimization
- Computes maximum marks using 0/1 Knapsack DP
- Shows selected topics for focus
- DP Table Visualization
- Step-by-step DP array evolution after each topic
- Create a 1D DP array:
dp[t] = maximum marks achievable using t hours
Iterate through topics:
for each topic:
for t = totalHours down to topic.time:
dp[t] = max(dp[t], dp[t-topic.time] + topic.marks)
Track which topics are selected (backtracking using choice array)
Display results and DP table in UI