Skip to content

this is one of the projects of 42 school in this project, we need to sort a stack of number with some rules, like using only 2 stack.

License

Notifications You must be signed in to change notification settings

luizlcezario/push_swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github-Explorer

Luiz Cezario GitHub last commit Stargazers

Push Swap of 42. Make with ❤︎ for Luiz Cezario

SoLong

This project is about sorting stacks algoritmics, in this we need to use algoritmics to choose what is the best moves to do to sort a stack, this moves was:

  • ra: move all the stack a forward making the last element be the first.
  • rb: move all the stack b forward making the last element be the first.
  • rr: move all the stack a and b forward making the last element be the first.
  • rra: move all the stack a behind making the first element the last.
  • rrb: move all the stack b behind making the first element the last.
  • rrr: move all the stack a and b behind making the first element the last.
  • sa: change the fisrt elemnt with the second in stack a.
  • sb: change the fisrt elemnt with the second in stack b.
  • ss: change the fisrt elemnt with the second in stack a and b.
  • pa: move the first element of stack b to the first element of stack a.
  • pb: move the first element of stack a to the first element of stack b.

My Algoritmic

I use a ideia of quick sort to choose the moves, I find a pivot and move all number of is smaller than to a stack b and then my code continue to do that until they have less then 25 in stack b they use a insertion sort to choose what number to send to a ordening.

So long, and thanks for all the fish!

Give ⭐️ if you like this project, this will help me!

About

this is one of the projects of 42 school in this project, we need to sort a stack of number with some rules, like using only 2 stack.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published