-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README and fixed the file name in MergeSort.h/
- Loading branch information
Ovidio de Jesus Henriquez
committed
Dec 26, 2016
1 parent
7dd8ad6
commit a0f7e43
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |