Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/abranhe/mergesort.c

Merge Sort algorithm in C
https://github.com/abranhe/mergesort.c

abranhe algorithm allalgorithms c clib merge-sort mergesort sort sorting-algorithms

Last synced: 26 days ago
JSON representation

Merge Sort algorithm in C

Awesome Lists containing this project

README

        









mergesort.c: Merge Sort algorithm library in C












In computer science, merge sort is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output.

## Installation

*Installing using [Clib](https://github.com/clibs/clib)*

```sh
$ clib install abranhe/mergesort.c
```

## Usage

```c
#include "mergesort.h"

int main()
{
int arr[] = {10, 7, 12, 27, 30};

mergeSort(arr, 0, 5);
// 7 10 12 27 30
}
```

See a real [example][example].

## API

#### `void mergeSort(arr, first, last);`

*Implement merge sort.*

###### Params:

- `array`: unsorted Array
- `first`: first element of the array to start sorting
- `last`: last element of the array to finish sorting

## Team

|[![Carlos Abraham Logo][abranhe-img]][abranhe]|
| :-: |
| [Carlos Abraham][abranhe] |

## License

[MIT][license] License © [Carlos Abraham][abranhe]

[abranhe]: https://github.com/abranhe
[abranhe-img]: https://avatars3.githubusercontent.com/u/21347264?s=50
[license]: https://github.com/abranhe/mergesort.c/blob/master/license
[example]: https://github.com/abranhe/mergesort.c/blob/master/example.c
[travis-badge]: https://img.shields.io/travis/abranhe/mergesort.c.svg
[travis-status]: https://travis-ci.org/abranhe/mergesort.c
[coverage-badge]: https://img.shields.io/coveralls/abranhe/mergesort.c.svg
[coverage-status]: https://coveralls.io/r/abranhe/mergesort.c?branch=master