Giter Site home page Giter Site logo

victorsuarezl / 42-push-swap Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 106 KB

This repository contains the implementation of the Push Swap algorithm.

Makefile 6.00% C 90.42% Python 3.58%
42-push-swap 42born2code 42projects 42school educational push-swap42

42-push-swap's Introduction

Push Swap

This repository contains the implementation of the Push Swap algorithm.

Table of Contents

Introduction

Push Swap is a sorting algorithm that operates on a stack of integers. It aims to sort the stack in ascending order using a limited set of operations.

This repository provides an implementation of the Push Swap algorithm in C.

Installation

To use the Push Swap algorithm, follow these steps:

  1. Clone the repository: git clone https://github.com/your-username/push-swap.git
  2. Navigate to the project directory: cd push-swap
  3. Compile the program: make
  4. Run the program: ./push_swap <list of integers>

Usage

The Push Swap algorithm takes a list of integers as input and outputs a series of operations that sorts the integers in ascending order. The available operations are:

  • sa: Swap the first two elements of the stack A.
  • sb: Swap the first two elements of the stack B.
  • ss: Swap the first two elements of both stack A and stack B.
  • pa: Push the first element of stack B to stack A.
  • pb: Push the first element of stack A to stack B.
  • ra: Rotate the stack A (move the first element to the end).
  • rb: Rotate the stack B (move the first element to the end).
  • rr: Rotate both stack A and stack B.
  • rra: Reverse rotate the stack A (move the last element to the beginning).
  • rrb: Reverse rotate the stack B (move the last element to the beginning).
  • rrr: Reverse rotate both stack A and stack B.

42-push-swap's People

Contributors

victorsuarezl 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.