Skip to content

sorts numbers by using push-swap instruction language

Notifications You must be signed in to change notification settings

appak21/push-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

push-swap

Algorithm: Radix Sort

Usage: push-swap

As an argument, enter numbers or use -rand flag to use randomly generated numbers

Each result will be saved in push-swap-result.txt file. So if you want to test big numbers using -rand flag, you can see what numbers random number generator gave and what instructions were used to sort them. It helps you easily copy/paste for checker program.

$ go run . "2 1 3 6 5 8"
pb
pb
ra
sa
rrr
pa
pa
$ go run . "0 one 2 3"
Error
$ go run . -rand
Numbers will be randomly generated in the range [min,max).
Enter the minimum, maximum values and the length of numbers in order.
min max length
-100 100 5
ra
pb
ra
pa
$

Usage: checker

$ echo -e "rra\npb\nsa\n" | go run ./checker "3 2 one 0"
Error
$ echo -e "rra\npb\nsa\nrra\npa"
rra
pb
sa
rra
pa
$ echo -e "rra\npb\nsa\nrra\npa" | go run ./checker "3 2 1 0"
OK
$ ARG="4 67 3 87 23"; ./push-swap "$ARG" | go run ./checker "$ARG"
OK

Algorithm explanation

About

sorts numbers by using push-swap instruction language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages