/5-42-push-swap

Program to sort stack of numbers in ascending order with help of one extra stack

Primary LanguageC

5-42-push-swap

Program to sort stack of numbers in ascending order with help of one extra stack

Push-swap Project

The Push swap project is a very simple and a highly straightforward algorithm project: data must be sorted. A set of integer values, 2 stacks, and a set of instructions to manipulate both stacks are available. The goal is to write a program in C called push_swap which calculates and displays on the standard output the smallest program, made of Push swap language instructions, that sorts the integers received as arguments.

How to use

  • clone
  • make
  • run with bash: ./push_swap your numbers separated by space
  • if the sequence is already sorted in ascending order - it won't return anything! gif1

With visualizer:

gif3

Sources: