Skip to content

inno-aca/push_swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Push_swap

The Push_swap project is part of the 42 school curriculum, challenging students to create an algorithm that efficiently sorts a stack of integers using a limited set of instructions. The project includes a bonus section with a checker to verify proper sorting and a visualization of the sorting process.

Overview

The project consists of two main parts:

Push_swap

The main push_swap program implements the sorting algorithm for a stack of integers using a specified set of instructions. The goal is to minimize the number of moves to sort the stack.

Checker

The checker program, located in the bonus folder, validates whether the stack is correctly sorted after executing a series of commands generated by push_swap.

Usage

  1. Clone the repository:
git clone https://github.com/seungwonme/push_swap.git
  1. Navigate to the project directory:
cd push_swap
  1. Compile the push_swap and optionally the checker executable:
make
  1. To compile the bonus checker:
make bonus
  1. Run the push_swap program with a list of integers:
./push_swap 5 2 1 4 3
  • Check if the stack is sorted using the checker program:
ARG="5 2 1 4 3"; ./push_swap $ARG | ./checker $ARG
  • To clean up object files:
make clean
  • To delete all build files:
make fclean
  • To clean and rebuild the executables:
make re

Sorting Visualization

To visualize the sorting process, visit the Push_swap Visualizer website.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published