Add new cpp/algorithms directory, include basic selection sort example

This commit is contained in:
2021-01-17 17:01:39 -05:00
parent 245e04e083
commit d4f6fb9d41
4 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
/*#############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2020 Shaun Reed, all rights reserved ##
## About: An example implementation of selection sort using a custom library ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
###############################################################################
*/
#ifndef LIB_SELECT_H
#define LIB_SELECT_H
#define ARRAY_LENGTH 10
/** RandomArray
* Returns an array automatically filled with random values
* Sizes array to match length setting ARRAY_LENGTH
* @return A pointer to a static array
*/
int * RandomArray();
/** SelectionSort
* Sorts an array of integers in ascending order
* @param arr The array to sort
*/
void SelectionSort(int arr[]);
/** PrintArray
* Prints an array based on the define ARRAY_LENGTH
* @param arr The array to print
*/
void PrintArray(int arr[]);
#endif // LIB_SELECT_H