CoolFace
Apppublic

YuchengChen/Sorting_Project

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
README.txt34 linesDownload Raw Back to root
1# Simple Bubble Sort App
2
3A Python app to visualize the Bubble Sort algorithm using Gradio.
4
5## How to Run
61. Install: `pip install -r requirements.txt`
72. Run: `python app.py`
8
9## Computational Thinking Plan
10
11### 1. Decomposition
12I split the project into three parts:
13* **Input:** Getting numbers from a text box.
14* **Logic:** The double loop to compare and swap numbers.
15* **Output:** Showing the sorted list and the history of swaps.
16
17### 2. Pattern Recognition
18The main pattern is **comparing neighbors**: `if nums[j] > nums[j+1]`, we swap them. This repeats until the list is sorted.
19
20### 3. Abstraction
21I hide the complex code (loops and indices) and only show the user the **list changes**
22
23### 4. Algorithm Design
24Flow: `User Input` -> `Check Errors` -> `Loop & Swap` -> `Update UI`.
25
26![Flowchart](flowchart.png)
27
28## Testing
29* **Test:** `5, 1, 3` -> Result: `1, 3, 5` (Working)
30* **Test:** `a, b, c` -> Result: `Error message` (Handled)
31
32## Links
33* **GitHub:** [Your GitHub Link]
34* **Hugging Face:** [Your Hugging Face Link]