Ask Question
3 May, 13:37

You can sort a large array of integers that are in the range 1 to 100 by using an array count of 100 items to count the number of occurrences of each integer in the array. Fill in the details of this sorting algorithm, which is called a bucket sort, and write a C function that implements it. What is the order of the bucket sort

+1
Answers (1)
  1. 3 May, 16:30
    0
    See explaination

    Explanation:

    #include

    using namespace std;

    void bucketSort (int arr[], int size)

    {

    int count[101]={0};

    for (int i=0; i
    count[arr[i]]++;

    int k=0;

    for (int i=1; i<=100; i++)

    {

    while (count[i]>0)

    {

    arr[k++]=i;

    count[i]--;

    }

    }

    }

    int main ()

    {

    int arr[]={1,2,5,4,3,9,8,7,6};

    bucketSort (arr, 9);

    for (int i=0; i<9; i++) cout<
    cout<<"/n";

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “You can sort a large array of integers that are in the range 1 to 100 by using an array count of 100 items to count the number of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers