formatting source-code for 153fb7b8a5

This commit is contained in:
github-actions
2020-05-30 04:02:09 +00:00
parent 92fe9495ec
commit 8a2de9842b
175 changed files with 1671 additions and 3460 deletions

View File

@@ -4,14 +4,12 @@
#include <vector>
// Function to sort arr[] of size n using bucket sort
void bucketSort(float arr[], int n)
{
void bucketSort(float arr[], int n) {
// 1) Create n empty buckets
std::vector<float> *b = new std::vector<float>[n];
// 2) Put array elements in different buckets
for (int i = 0; i < n; i++)
{
for (int i = 0; i < n; i++) {
int bi = n * arr[i]; // Index in bucket
b[bi].push_back(arr[i]);
}
@@ -27,8 +25,7 @@ void bucketSort(float arr[], int n)
}
/* Driver program to test above funtion */
int main()
{
int main() {
float arr[] = {0.897, 0.565, 0.656, 0.1234, 0.665, 0.3434};
int n = sizeof(arr) / sizeof(arr[0]);
bucketSort(arr, n);