Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by wkrati.

Push_Swap


Quick Overview

  • Built with: C
  • Focus: Stack-based sorting, algorithms, and optimization under constraints.
  • What I learned: Problem solving, operation minimization, edge-case handling, and algorithmic thinking.

Description

The push_swap project is an algorithmic challenge whose objective is to sort a stack of integers in ascending order using a restricted set of operations.

The program takes a list of integers as command-line arguments, stores them in stack A, and outputs a sequence of instructions that sorts the stack while minimizing the number of operations, in accordance with the project rules.

Instructions

Compilation

make

Execution

./push_swap 4 67 3 87 23

Example with randomly generated values:

ARG=$(shuf -i -1000:1000 -n 100 | tr '\n' ' ')
./push_swap $ARG

Cleaning

make fclean

Resources

  • 42 official push_swap subject
  • Unix manual pages:
    • man write
    • man malloc
    • man free
  • Stack data structures and linked lists
  • Sorting algorithms and optimization strategies

AI Usage

AI tools were used as a learning assistant to:

  • Clarify algorithmic concepts and constraints
  • Assist in reasoning about edge cases and debugging
  • Support understanding of optimization strategies

All code was written, tested, and validated manually by the student, in compliance with the 42 curriculum rules.

About

Algorithmic sorting project in C using stack operations, constraints, and optimization strategies.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages