Skip to content

Latest commit

 

History

History

sorting_algorithms

Sorting Algorithms

This repo contains implementation of several sorting algorithms for both arrays or linked lists.

First, I recommend to test your skills in time complexity (Big O notation) by passing his exam (will update soon)

Algorithms

The following algorithms are commonly used for sorting data in various applications.

Helper Functions and files

This section will be updated over the time.

Getting Started

Building the Project

  1. Clone this repository to your local machine.

  2. Change to sorting_algorithms directory:

  3. Compile the project:

    gcc *.c -o a
    ./a 

Usage

Sorting Arrays

To sort an array using one of the implemented algorithms, you can call the respective sorting function and provide your array and its size as parameters. For example, to sort an array using Bubble Sort:

int array[] = {5, 2, 9, 3, 6};
size_t size = sizeof(array) / sizeof(array[0]);
bubble_sort(array, size);

Sorting Linked Lists

To sort a linked list, you can create a list from an array and then call the sorting function for linked lists. For example:

int array[] = {5, 2, 9, 3, 6};
size_t size = sizeof(array) / sizeof(array[0]);
listint_t *list = create_listint(array, size);
insertion_sort_list(&list);

Contributing

Contributions to this project are welcome. If you'd like to contribute, please fork the repository, make your changes, and submit a pull request. Be sure to follow best practices and maintain code quality.

Feel free to customize this README file further to include more project-specific details or instructions as needed.