Skip to content

Commit

Permalink
Updated README and fixed the file name in MergeSort.h/
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovidio de Jesus Henriquez committed Dec 26, 2016
1 parent 7dd8ad6 commit a0f7e43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MergeSort.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** File Name: MergeSort.H
** File Name: MergeSort.h
** Author: Ovidio de Jesus Henriquez
**
** This file contains my implementation of the merge sort algorithm to use for
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# MergeSort
This repository will contain my C++ implementation of the merge sort algorithm for educational purposes.

# Compile Instructions
In the terminal, run the following:
```
make all
```

# Execution Instructions
To run the test file, run the ```test.bin``` file produced by the compiler.

# Algorithm Details
The algorithm is implemented as follows. The MergeSort.h file contains a single function named ```merge_sort```
that accepts any one dimensional vector of any type (as long as the type has a less than or equal to operator).
The algorithm first divides the given vector in half and recursively calls the ```merge_sort``` function.
Once the subvectors are equal to 1 element in size, the single element is returned. The next step in the algorithm
is to sort the two halves of the subvectors by iterating through each of them and inserting the elements
into a new sorted vector in order from least to greatest. Once the sorting is finished, the sorted vector is
returned.

0 comments on commit a0f7e43

Please sign in to comment.