Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/trobert42/push_swap

Sorting numbers with two stacks in C
https://github.com/trobert42/push_swap

chained-list optimization-algorithms sorting-algorithms

Last synced: 9 days ago
JSON representation

Sorting numbers with two stacks in C

Awesome Lists containing this project

README

        

# Sorting integers with two stacks

The Push_swap project involves sorting an array of integers using two stacks and a set of instructions. The goal is to create a program that sorts the integers received as arguments. This project aims to teach basic algorithms, complexity concepts, and C language programming. The instructions include writing code in C, adhering to coding norms and properly freeing heap-allocated memory space. The stacks 'a' and 'b' contain unique integers, and the task is to sort stack 'a' in ascending order using instructions such as sa, sb, ss, pa, pb, ra, rb, rra, and rrb, which swap, push, and rotate elements within the stacks.

| Project Name | push_swap |
| :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: |
| Description | A sorting algorithm using stacks with a limited set of instrutions and using the lowest possible number of actions |
| Technologies | C |
| External libraries | read(), write(), malloc(), free(), exit() |

## Usage

```bash
gcl https://github.com/trobert42/push_swap.git
cd push_swap
make
./push_swap [list of numbers]
```

## 💬
Big thanks to Nicolas for helping me understand the LIS (Longest Increasing Subsequence), on which i based my sorting code on it o/