Add example for bucket sort
This commit is contained in:
23
cpp/algorithms/sorting/bucket/lib-bucket.hpp
Normal file
23
cpp/algorithms/sorting/bucket/lib-bucket.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: An example implementation of bucket sort using a custom library ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
###############################################################################
|
||||
*/
|
||||
|
||||
#ifndef LIB_BUCKET_HPP
|
||||
#define LIB_BUCKET_HPP
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
// For this example double the size of the array to increase chance of collision
|
||||
#define ARRAY_LENGTH 20
|
||||
// Define how many buckets we want to use
|
||||
#define BUCKET_ARRAY_LENGTH 10
|
||||
|
||||
void BucketSort(std::vector<float> &array);
|
||||
|
||||
#endif // LIB_BUCKET_HPP
|
||||
Reference in New Issue
Block a user