An educational frontend app built with React and browser-only logic. Explore greedy decision-making through animated visualizations, customizable input scenarios, and step-by-step explanations.
This repository contains a single-page visualizer that helps users understand how greedy algorithms operate. The app runs entirely in the browser and uses a neon-dark UI with glowing highlights to make each decision feel like machine reasoning.
- Uses the largest available coin first.
- Visualizes current remaining amount and coin selections.
- Demonstrates where greedy works and when exact change may not be possible.
- Sorts activities by finish time and selects the earliest finisher that fits.
- Displays timeline bars for each interval.
- Highlights chosen activities and skipped overlaps.
- Sorts items by value-to-weight ratio.
- Fills knapsack capacity greedily.
- Shows partial item inclusion and total value accumulated.
- Switch algorithms with the sidebar.
- Edit inputs directly for each problem type.
- Advance one greedy decision at a time using
Next Step. - Use
Auto-Playto animate the full greedy process automatically. - Adjust playback speed with the slider.
- Read a decision log of each greedy pick in plain English.
- Reset the demo and export the decision log as a text file.
Greedy algorithms are easy to describe but not always optimal. This visualizer helps learners:
- see the exact choice made on each iteration
- compare greedy behavior across problems
- understand the mechanics of greedy selection
- observe how partial selection works in fractional knapsack
Denominations:1,5,10,25Target amount:93
Intervals:1,4 3,5 0,6 5,7 3,8 5,9 6,10 8,11 8,12 2,13 12,14
Capacity:50Items:60,10 100,20 120,30
- Open
index.htmldirectly in your browser. - Or use a local static server for best compatibility.
- Install the Live Server extension.
- Right-click
index.htmland selectOpen with Live Server.
index.html— app container, fonts, and React importsstyles.css— dark theme, responsive layout, animationsapp.jsx— React components, algorithm logic, visualizationREADME.md— project documentation and usage guide
- No backend or API is used.
- All greedy algorithms are coded from scratch in
app.jsx. - Uses React with Babel in the browser for simplicity.
- Designed to be mobile-responsive and visually engaging.
This project is ideal for demonstrating:
- greedy selection strategy
- step-by-step algorithm execution
- the importance of problem-specific choice rules
- how visualization supports intuitive learning
- Sabyasachi Panda
- Sameer Kumar