Skip to content

LEVEL-09/Push_swap

Repository files navigation

Push_Swap

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

Description

Push_Swap is project that consists of sorting numbers using two stacks (Stack A and Stack B) with a specific moves. The goal is to sort a list of 100 integers in less then 700 moves and a list of 500 integers in less then 5500 moves. Bonus part is to create a checker that will check if the list is sorted correctly.

Instructions

  1. To compile the push_swap program, run the following command in your terminal:

    make

    For checker program, use:

    make bonus
  2. To run the push_swap program, use command with a list of integers as arguments:

    ./push_swap [list of integers]

    Example:

    ./push_swap 3 2 5 1 4

    This will output the sequence of operations needed to sort the list.

  3. To run the checker program, use command with a list of integers as arguments and start providing operations via standard input:

    ./checker [list of integers]

    Example:

    ./checker 3 2 5 1 4

    Then, provide the operations line by line, followed by EOF (Ctrl+D on Unix/Linux or Ctrl+Z on Windows).

Any invalid arguments in push_swap or checker will get "Error" printed on the standard error output.

Resources

I use AI to explain how to swap linked list and debug segfault in my code.

About

In this project, about sort data in a stack using a limited set of instructions, aiming to achieve the lowest possible number of actions. To succeed, i use various algorithms and choose the most appropriate one for optimized data sorting.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors