Git Product home page Git Product logo

42sp-push_swap's Introduction

42 Cursus

push_swap

push_swap Logo

Push_swap is a sorting algorithm project that aims to sort a stack of integers using a limited set of operations while minimizing the number of moves. The goal is to implement two programs: one that checks if a given list of instructions sorts the stack, and another that generates the list of instructions to sort the stack.

Description

The push_swap program uses a sorting algorithm that involves manipulating two stacks, commonly referred to as Stack A and Stack B. The algorithm follows a combination of operations like pushing, rotating, reverse rotating, and swapping elements between the two stacks to sort the numbers. To do this project, I've implemented the Turk Algorithm, an optimization algorithm created by Ali Yigit Ogun: a student from 42 Heilbronn school.

Installation

Follow the steps below to test the project:

  1. Clone the repository:
git clone https://github.com/your-username/push_swap.git
  1. Compile the project:
make
  1. Run the program with the following syntax:
./push_swap num1 num2 num3 num4 num5
  • num: unique numbers in a non-ascending order.

Examples

./push_swap 8 5 2 4 9 1 3

Visualizer

To better understand the algorithm and operations done in the push_swap project you can download a GUI to experience a visual demonstration.

42sp-push_swap's People

Contributors

beatrizdile avatar

Stargazers

M Syafik M Isa avatar Daniele avatar Munira Tashrifwala avatar Jake L avatar  avatar Maria Juliana Pereira avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.