From 9fd51d9a7047d48dca16b8d9eec05071373eb829 Mon Sep 17 00:00:00 2001 From: Abdurrezzak Efe Date: Mon, 30 Oct 2017 15:33:55 +0200 Subject: [PATCH] Add files via upload --- 11.BucketSort.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 11.BucketSort.cpp diff --git a/11.BucketSort.cpp b/11.BucketSort.cpp new file mode 100644 index 0000000..d7d5315 --- /dev/null +++ b/11.BucketSort.cpp @@ -0,0 +1,47 @@ +/* + * This program takes an array from the user + * sorts it using bucket sort + * Prints the sorted array + * For more information about Bucket Sort Algorithm: https://en.wikipedia.org/wiki/Bucket_sort + * + * Coded by: Abdurrezak EFE + * + * */ +#include +#include +#include +using namespace std; + +void bucket_sort(float arr[], int k) +{ + vector v[k]; //creating buckets + + int num; + for(int i=0;i> k; + + float arr[k]; + for(int i=0;i> arr[i]; + + bucket_sort(arr, k); //sorting + + for(int i=0;i