A simple and educational console application written in C, demonstrating the behaviour of classic sorting algorithms.
The user interacts through a clean menu and can choose which algorithm to apply to a fixed‑size array of integers.
Ideal for learning, demonstrations, or quick testing of sorting logic.
The program includes the following sorting algorithms:
- Selection Sort
- Insertion Sort
- Bubble Sort
- Bogo Sort (intentionally inefficient, included for demonstration)
Each algorithm sorts an array of integers in ascending order.
- Clone the repository:
git clone <repository-link>
- Open the project in your preferred C development environment
(Visual Studio, Code::Blocks, VSCode, etc.). - Compile the
.cfile. - Run the program.
- Choose a sorting algorithm from the menu and enter your numbers.
Finds the smallest element and places it in the correct position at each iteration.
Builds a sorted portion of the array by inserting each element into its correct place.
Repeatedly compares adjacent elements and swaps them if they are out of order.
Randomly shuffles the array until it becomes sorted.
⚠️ Extremely inefficient — included only for educational purposes.
- Menu system
- Functions to:
- Read array
- Print array
- Execute each sorting algorithm
- Check if the array is sorted (for BogoSort)
- Shuffle the array
switchstatement to select the algorithm
+------------------------------------+
| ARRAY SORTING |
|------------------------------------|
| 1 - Selection Sort |
| 2 - Insertion Sort |
| 3 - Bubble Sort |
| 4 - Bogo Sort |
| |
| 0 - Exit Program |
+------------------------------------+
Enter your choice: 1
Selection Sort
Enter 10 numbers:
0: 5
1: 2
2: 9
...
Ascending Order:
2 5 9 ...
Contributions are welcome!
If you’d like to improve the code, add new algorithms, or enhance the interface:
- Open an issue
- Submit a pull request
Project created by @16alves02.
Aplicação simples e educativa desenvolvida em C, que demonstra o funcionamento de vários algoritmos clássicos de ordenação.
O utilizador interage através de um menu intuitivo e escolhe qual o algoritmo a aplicar a um array de inteiros.
Ideal para aprendizagem, demonstrações em aula ou testes rápidos.
O programa inclui os seguintes algoritmos de ordenação:
- Selection Sort
- Insertion Sort
- Bubble Sort
- Bogo Sort (extremamente ineficiente, apenas demonstrativo)
Todos os algoritmos ordenam um array de inteiros em ordem crescente.
- Clonar o repositório:
git clone <link-do-repositório>
- Abrir o projeto num ambiente de desenvolvimento C
(Visual Studio, Code::Blocks, VSCode, etc.). - Compilar o ficheiro
.c. - Executar o programa.
- Escolher o algoritmo no menu e introduzir os números pretendidos.
Procura o menor elemento e coloca-o na posição correta.
Insere cada elemento na posição correta da parte já ordenada do array.
Compara elementos adjacentes e troca-os se estiverem fora de ordem.
Baralha o array repetidamente até ficar ordenado.
⚠️ Muito ineficiente — incluído apenas para fins educativos.
- Menu principal
- Funções para:
- Ler array
- Escrever array
- Executar cada algoritmo
- Verificar se o array está ordenado (para o BogoSort)
- Baralhar o array
- Estrutura
switchpara seleção do algoritmo
+------------------------------------+
| ARRAY SORTING |
|------------------------------------|
| 1 - Selection Sort |
| 2 - Insertion Sort |
| 3 - Bubble Sort |
| 4 - Bogo Sort |
| |
| 0 - Exit Program |
+------------------------------------+
Enter your choice: 1
Selection Sort
Enter 10 numbers:
0: 5
1: 2
2: 9
...
Ascending Order:
2 5 9 ...
Contribuições são bem-vindas!
Se quiseres melhorar o código, adicionar novos algoritmos ou melhorar a interface:
- Abre uma issue
- Envia um pull request
Projeto criado por @16alves02