scndcorp
Available
Work
École 42 ParisStudent, École 42 project

Push_swap: sorting a stack with a limited instruction set

École 42 project, a sorting algorithm in C for a stack of numbers using a restricted instruction set (swap, push, rotate, reverse rotate), while minimizing the number of operations.

École 42 Paris

Challenge

Sorting a stack of numbers using only a restricted set of operations, while minimizing the total number of instructions: a pure algorithmic problem where the sorting strategy makes all the difference.

Impact

  • Sorting a stack via a restricted instruction set
  • Strategy for optimizing the number of operations
  • Robust parsing and validation of inputs

Context

Push_swap is a project from the École 42 (Paris) curriculum, completed in 2022 as a student. The exercise serves as an algorithms playground within a deliberately constrained framework: it exercises the cost of moves and the memory management of stack structures, beyond sorting logic alone.

What was done

A sorting algorithm on two stacks in C, relying on the allowed operations (sa, pb, ra, rra…), with an optimization strategy for the number of operations and robust parsing of the input arguments.

Stack

The technologies used on this mission.

  • C
  • Algorithmique
  • Stack structures
  • Optimisation

A similar project in mind?

Let's talk through your challenges and see how to turn your vision into maintainable, tested technical reality.