How fuzzycactus42/push_swap works
push_swap is a command-line integer sorter: it parses and validates input, builds stack A, chooses a sorting strategy, and prints stack-operation instructions that leave A sorted and B empty. Adaptive selection uses disorder; users can also select Simple, Medium, or Complex, and optionally request benchmark statistics. The small-input Simple override is applied during input preparation. Relationships among the unsampled dispatcher, ranking, disorder, and benchmark implementations follow README descriptions; their source bodies were not provided.
Main entry points: main.c Program entry · push_swap.c Strategy dispatch · Operations Stack operations · str2int.c Token conversion
Components 18
Input and validation
- Program entry
main.c - Flag parsing
read_flags.c - Token conversion
str2int.c - Argument splitting
ft_split.c - Integer parsing
ft_atoi.c - Duplicate checks
check_dup_error.c
Strategy and reporting
- Strategy dispatch
push_swap.c - Disorder measure
get_disorder.c - Benchmark statistics
bench.c - Printed instructions
- Benchmark report
Sorting strategies
- Rank values
ranking.c - Simple extraction
Algorithms/simple.c - Medium chunks
Algorithms/medium.c - Complex radix
Algorithms/complex.c
Stacks and operations
- Stack storage
stack_utils.c - Stack operations
Operations
Other components
- CLI user
Connections 20
- CLI user → Program entry: provides arguments
README.md - Program entry → Flag parsing: parses options
main.c - Program entry → Token conversion: converts values
main.c - Token conversion → Argument splitting: splits arguments
str2int.c - Token conversion → Integer parsing: parses tokens
str2int.c - Program entry → Duplicate checks: checks uniqueness
main.c - Program entry → Stack storage: fills stack
main.c - Program entry → Strategy dispatch: starts sorting
README.md - Strategy dispatch → Disorder measure: measures disorder
README.md - Strategy dispatch → Simple extraction: selects strategy
README.md - Strategy dispatch → Medium chunks: selects strategy
README.md - Strategy dispatch → Complex radix: selects strategy
README.md - Medium chunks → Rank values: ranks values
Algorithms/medium.c - Complex radix → Rank values: ranks values
Algorithms/complex.c - Simple extraction → Stack operations: issues operations
Algorithms/simple.c - Medium chunks → Stack operations: issues operations
Algorithms/medium.c - Complex radix → Stack operations: issues operations
Algorithms/complex.c - Stack operations → Printed instructions: prints instructions
Operations/push.c - Strategy dispatch → Benchmark statistics: reports counts
README.md - Benchmark statistics → Benchmark report: writes statistics
README.md