# Getting Started

This project is a small Java Swing application for exploring sorting algorithms. The main window lets you choose an algorithm, then a second window accepts a space-separated list of integers, sorts it, and displays both the algorithm name and the result. It is designed as a learning/demo app rather than a library or service.

## What This Project Does

- Presents a GUI menu for six sorting options.
- Accepts integer input, runs the selected sort, and shows the sorted output.
- Opens a matching text file with the algorithm’s source/notes through the **Open Code** button.

## Recommended Reading Order

1. `README.md` — start here for the project’s purpose, screenshots, and the high-level flow.
2. [`src/algo_Calc/Frame.java`](src/algo_Calc/Frame.java) — understand the main menu and how users choose an algorithm.
3. [`src/algo_Calc/Sortingss.java`](src/algo_Calc/Sortingss.java) — read the input/execute/output screen and the sorting implementations.

## Key Entry Points

The codebase has no deeply interconnected class graph, so the fastest path is to read the two GUI classes first:

- [`algo_Calc.Frame`](src/algo_Calc/Frame.java) — the launch window. It creates the menu buttons and passes a selection key to the next screen.
- [`algo_Calc.Sortingss`](src/algo_Calc/Sortingss.java) — the workhorse class. It renders the second window, parses input, dispatches to the chosen algorithm, and opens the related text file.

Supporting algorithm helpers are defined in the same file as package-private classes:

- `quiks` inside [`Sortingss.java`](src/algo_Calc/Sortingss.java) — quicksort helper.
- `merg` inside [`Sortingss.java`](src/algo_Calc/Sortingss.java) — merge sort helper.
- `heaps` inside [`Sortingss.java`](src/algo_Calc/Sortingss.java) — heap sort helper.

## Project Structure

```mermaid
flowchart TD
A["README.md"] --> B["src/algo_Calc/Frame.java"]
B --> C["src/algo_Calc/Sortingss.java"]
C --> D["Algorithm helpers"]
```

- `src/algo_Calc/Frame.java` contains the first GUI frame and the algorithm selection buttons.
- `src/algo_Calc/Sortingss.java` contains the second GUI frame, the submit/open-code actions, and the sorting logic.
- `bubble.txt`, `selection.txt`, `quicksort.txt`, `insertion.txt`, `merge.txt`, and `maxheap.txt` are the algorithm reference files opened from the UI.
- `Images/` contains screenshots used by the project documentation.
- `bin/` and `src/algo_Calc/*.class` are compiled artifacts; treat them as build outputs.

## Configuration

There is very little runtime configuration. The main things to know are:

- The application starts from `algo_Calc.Frame` or `algo_Calc.Sortingss` depending on whether you want the menu or the full sorter view.
- The “Open Code” action launches `Notepad.exe` and opens one of the `*.txt` files in the repository root.
- Input must be space-separated integers in the text field; the parser splits on spaces and converts each token with `Integer.parseInt(...)`.

## Common Patterns

- **GUI-driven flow**: button listeners move between screens and pass a small integer key to choose the algorithm.
- **Single-file helpers**: the sort implementations live alongside the main UI class instead of being split into separate modules.
- **Imperative sorting logic**: each algorithm mutates the input array in place and then formats the result for display.
- **Swing + AWT event model**: the app uses `EventQueue.invokeLater(...)`, `ActionListener`, `JFrame`, `JButton`, `JTextField`, and `JTextArea` throughout.
- **External viewer integration**: the “Open Code” button uses `ProcessBuilder` to launch the associated text file in the system editor.

## Where to Go Next

After reading the two main classes, skim the sorting branches inside [`src/algo_Calc/Sortingss.java`](src/algo_Calc/Sortingss.java) to compare how each algorithm is implemented and how the output string is built.