GithubHelp home page GithubHelp logo

push_swap's Introduction

push_swap

This project is about using two stacks A and B, as well as a few pre-selected stack operations to sort a list of unsorted integers. From this project, I learnt how to implement doubly linked lists in the context of stacks and stack operations / manipulation and a general overview of different types of sorts and their time and space complexities.

Testers:

https://github.com/laisarena/push_swap_tester
https://github.com/gemartin99/Push-Swap-Tester
https://github.com/louisabricot/push_swap_tester

References:

https://md.picasoft.net/ygePDdPSR4KN1PzJ50KHaw?view

Visualisation:

100 numbers: https://tinyurl.com/100numsort
500 numbers: https://tinyurl.com/500numsort

How to use:

  1. Clone the repository
git clone https://github.com/rsoo23/push_swap.git push_swap
  1. Make the executable
make
  1. Input the arguments (int must be within the int range) (redirect the output into an output file)
./push_swap "int int ..." > out
  1. Go to the website below, copy and paste the unsorted numbers and the moves from the output file into the respective fields
https://codepen.io/ahkoh/full/bGWxmVz

Bonus:

A checker that takes in the list of unsorted numbers and takes in moves to check if the moves sort the list

  1. Make the checker executable
make bonus
  1. Input the arguments and press enter (int must be within the int range)
./push_swap "int int ..."
  1. Enter your moves (press enter after every new move)
./push_swap "int int ..."
rra
sa
  1. Press Ctrl + D to end the instruction reading and get the result (OK = sorted / KO = not sorted)
./push_swap "int int ..."
rra
sa
KO / OK

push_swap's People

Contributors

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