JacqHazzard/BubbleSortMakerCISC121
0
I chose Bubble Sort beacuse its straightforward, iterative process-where the alrgest values "bubble up"- is ideal for clear, step-by-step visual demonsrtation. This simplicity directly supports the goal of creating an easy to understand interactive learning app.
A. Decomposition
- Input Parsing: Handle user string input and convert it safely to a list of integers.
- Core Sorting: Implement the Bubble Sort algorithm's comparison and swap logic.
- Visualization & Logging: Record the array state at every step and translate the final state into a Matplotlib bar chart.
- UI/Deployment: Integrate all modules using Gradio for a user-friendly interface.
B. Pattern Recognition
- The core pattern is the repeated operation: Compare Adjacent Elements --> Swap If Out of Order.
- This pattern is repeated in a predictable manner across $N$ passes, allowing for the creation of an accurate, step-by-step log of the algorithm's execution
C. Abstraction
- Input: Read string from
gr.Textbox. - Process: Call
visualize_sort()which: - Parses the string (check for errors).
- Calls
bubble_sort()to get the sorted list and the execution log (steps). - Generates the Matplotlib plot from the final sorted list.
- Output: Display the text log in the
gr.Textboxand the plot image in thegr.Imagecomponent.
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
