C Program to implement Bucket sort

In this article, you will learn bucket sort in c program.

Bucket Sort Algorithm:

This is a sorting technique where it first divides the elements into several groups which are called buckets.
Several buckets are created and each bucket is filled with a specific range of elements. These specific elements assigned to each bucket are sorted using any suitable algorithm and then the buckets are brought together to get the sorted array.

This process can be realized as a scattering and gathering approach where first elements are scattered into various buckets and each bucket is sorted within themselves and then finally gathered in order.


  • Worst Case Complexity: O(n2)
  • Average Case Complexity: O(n)
  • Best Case Complexity:O(n+k)

C program to sort an array using bucket sort

The output c program to implement Bucket sort:

Bucket sorting in c program

Also, learn
C Program