How dina-elgammal/push_swap_42 works
Project type and purpose
• This is a command-line “Push_swap” tool written in C.
• Purpose: teach stack data structures and algorithm design by sorting integers using minimal stack operations.
File structure
Top-level:
• Push_swap/Makefile – build script
• push_swap.c – main entry point
• pre_checker.c – input validation
• main_sort_utilits.c – orchestration & algorithm selector
• sort_utilits.c, swap.c, push_to_stack.c, rotatedown2top.c, rotatetop2down.c – core stack operations
• helper.c, utilits.c, node_utilits.c – utility functions (array fill, counting, min/max)
• push_swap.h – shared data structures & function signatures
README for additional insights
• Describes a two-stack model (stk_a, stk_b)
• Outlines three entry algorithms: sort_3, sort_5, sort_main_algo (chunk-based)
• Breaks down major helper routines: fill_sort_arr, move_chunk, push_remaining, push_back_chunks
• Labels: clear names for each module and data structure (e.g., “Stack Operations”, “sort_main_algo”)
– Rectangles for code modules
– Parallelograms for I/O (CLI input, operation sequence output)