Giter Site home page Giter Site logo

hu8813 / push_swap Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 1.0 315 KB

42 school project pushswap using radix sort

Makefile 4.83% C 81.64% Perl 6.05% Shell 0.76% Python 6.73%
42 42-push-swap push-swap push-swap-42 push-swap42 pushswap pushswap42 radix radix-sort sorting

push_swap's Introduction

Push_swap using Radix sort

Push_swap is a project that involves sorting a list of integers using a limited set of operations. The goal is to sort the list with the fewest possible number of operations.

overflow handling

Do not forget to check for error handling & leaks if a number is bigger/smaller than max/min long int or long long int (overflow) !

For testing error handling and finding memory leaks, use my tester here:

Link to the tester's repository: (https://github.com/hu8813/tester_push_swap)

Sorting results and points

Input Size Average Operations Maximum Operations allowed Points Visualize
3 1-2 3
5 5-10 12
100 855-857 <1300 4/5 link
500 5739-5741 <10000 4/5

Usage

To use the push_swap program, compile it with the make command and then run it with the list of integers to be sorted as arguments. i.e.:

./push_swap 3 1 2

To test with some random numbers:

make test (will test with 10 numbers as default)

to test with n random numbers:

make test size=n i.e. make test size=5

This will output if the program passes the test, amount of operations necessary to sort, if there are any memory leaks.

Optionally, you can use the checker program to verify that the list is correctly sorted after the operations are applied. To do this, run the checker program with the list of integers and the list of operations as arguments.

Test and see how many points you can get

run: perl push_swap_tester.pl size_of_stack how_many_tests

i.e. perl push_swap_tester.pl 100 10

will run 10 different tests with 100 different numbers each time and show you how many points you can get during evaluation

Link to the repository: (https://github.com/lorenuars19/push_swap_tester)

Visualize the results

Run bash visualizer.sh to get an online link that shows the visualization.

Edit the NBR_COUNT variable in visualizer.sh file to change the numbers to sort, i.e. NBR_COUNT=100 to sort 100 numbers and visualize it

GitHub Page of this Visualizer: https://github.com/Bluegales/push-swap-pain

OR

There is another, a better visualizer in python, but this needs tkinter library, which can not be installed on school pc as it needs root.

If you want to test on private pc, you can install the push-swap-gui python program from https://pypi.org/project/push-swap-gui/. This program allows you to see the sorting process of the Push_swap project in a graphical interface, making it easier to understand how the algorithms work. Simply follow the instructions on the website to install and run the program. If you get tkinter error, means you need to install tkinter via sudo apt install python3-tk

Resources

Useful resources for understanding and implementing sorting algorithms for the Push_swap project:

push_swap's People

Contributors

hu8813 avatar

Stargazers

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