Skip to content

push swap, a 42 school project about sorting numbers with 2 stacks

Notifications You must be signed in to change notification settings

biralavor/42_pushswap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

42_pushswap

push swap, a 42 school project about ordination algorithm.

push_swape 100sucess

Tip

This project was done with in TDD mode -> Test Driven Development. Screenshot from 2024-07-05 13-15-13

If you wanna try my tester, you should type:

cd _ci_tdd && make

Efficiency vs Efficacy

  • What's the difference between them?
  • Which one is required for the push_swap project?

Real Case Study

Let's suppose that you need to commute from your house to your work by car, but here is a traffic jam ahead, like Mr. Goofy from Disney: https://www.youtube.com/watch?v=_Tlk6e61E6w

Screenshot from 2024-05-28 19-43-27

Efficiency - The goal, whatever it takes

You can drive like Mr. Goofy but at crazy mode accelerating a lot, changing lanes every second, hitting brakes... and eventually arriving at work. Screenshot from 2024-05-28 19-34-53

Did you make the goal? Yes.

But probably, you burned some really important resources from your car (gas, oil, brakes, engine), and from yourself (mental health, stress, anxiety, etc...)

Efficacy - The goal, with minimal resources

However, you can also goes like the initial state from Mr. Goofy: a pleasant guy which could find another path or even just wait with pacience and love the innevitable truth: there will be a traffic jam ahead. Screenshot from 2024-05-28 19-39-16

Did you make the goal? Yes.

Without burning your brain, tires and fuel unnecessarily.

Push_Swap - Which one is required?

Push Swap is about a program that sort numbers from user's input, but also:

  • has 2 stacks to store the given numbers;
  • has 11 basic functions to move the numbers between stacks;
  • calculates the cost of every number, with a given target
  • search for the cheapest moviment
  • do the moviments to sort the list Even with cost calculation, this program works only with efficiency mode (the goal, whatever it takes). The project's algorithm was created by Mia Combeau: https://github.com/mcombeau/push_swap

Screenshot from 2024-07-05 13-24-06

If you wanna try my Push_Swap, you should type:

make