An open API service indexing awesome lists of open source software.

https://github.com/biralavor/42_pushswap

push swap, a 42 school project about sorting numbers with 2 stacks
https://github.com/biralavor/42_pushswap

cunit minunit pushswap-42 sorting-algorithms

Last synced: 4 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# 42_pushswap

| ![push_swap](https://github.com/biralavor/42_pushswap/assets/80487147/90c54513-52ea-419c-8db1-e9c315cbad69 "Push Swap") | Push Swap, a 42 school project about ordination algorithm. | ![100sucess](https://github.com/biralavor/42_libft/assets/80487147/814c0fe9-cf93-4f9d-bd18-5d588a896ea4) |
| :-: | :-: | :-: |

> [!TIP]
> This project was done with in TDD mode -> Test Driven Development.
> ![Screenshot from 2024-07-05 13-15-13](https://github.com/biralavor/42_pushswap/assets/80487147/e553f0a8-d8dd-48d3-966f-c462db1f5ba4)
>
> 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](https://github.com/biralavor/42_pushswap/assets/80487147/b1850197-2313-418f-a358-9bcae563a12c)

## 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](https://github.com/biralavor/42_pushswap/assets/80487147/1f2185cd-e3bf-4101-bd46-376fc05b07fd)

### 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](https://github.com/biralavor/42_pushswap/assets/80487147/230b0780-9505-41fc-b768-865745012a84)

### 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](https://github.com/biralavor/42_pushswap/assets/80487147/4c5fe75c-3006-4f0d-9fc2-27a555022c1f)

> If you wanna try my Push_Swap, you should type:
>
> ```
> make
> ```

> All 42 Badges -- the astronomer Human Coder -- were done by Larissa Cristina [@mewmewdevart](https://github.com/mewmewdevart/42Badges)