Giter VIP home page Giter VIP logo

push_swap's Introduction

Push Swap Project

Overview

The Push Swap project is an algorithmic challenge that requires sorting data on a stack, with a limited set of instructions, and using the smallest number of actions. Through this project, students learn about sorting algorithms and stack operations. The goal is to sort numbers into ascending order.

Objectives

Implement a sorting algorithm using two stacks. Optimize the algorithm to minimize the number of operations. Learn about stack data structures and sorting algorithms.

Installation

Clone the repository and navigate to the project directory. The project includes a Makefile for compiling the program.

git clone https://github.com/Lemine-Mahjoub/Push_Swap
cd Push_Swap

How to Compile

To compile the Push Swap program, run the following command in the root of the project directory:

make

This command will compile the push_swap binary.

Usage

After compiling the program, you can run it using the following syntax:

./push_swap [list of integers]

For example:

./push_swap 2 1 3 6 5 8

This will output a list of operations that sort the provided integers.

Testing

You can test the program with random numbers using a script or by manually entering numbers. For example, to test with 5 random numbers:

ARG=$(ruby -e "puts (1..5).to_a.shuffle.join(' ')"); ./push_swap $ARG

Replace 5 with any number of elements you wish to test.

push_swap's People

Contributors

lemine-mahjoub avatar

Stargazers

 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.