Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

push_swap

sort stack using limited instructions

Quicksort inspired algorithm

The used algorithm globally works like quicksort, with some tricks to lower the instructions using the rr, rrr and ss instructions.

Here is a simplified version.

sort_and_merge

More here

  1. find instructions to sort a
  2. find instructions to sort b
  3. compress them using rr, rrr and ss instructions

quicksort stack a

More here

  1. if len <= 3, then b last part should be less than or equal to 3 in len, so call sort_and_merge function and return
  2. push every values less than median to stack b
  3. call quicksort stack a
  4. call quicksort stack b

quicksort stack b

More here

  1. push every values more than median to stack a
  2. call quicksort stack a
  3. call quicksort stack b

About

sort stack using limited instructions

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages