Javatpoint Logo
Javatpoint Logo

Bucket Sort

Bucket sort is also known as bin sort. It works by distributing the element into the array also called buckets. Buckets are sorted individually by using different sorting algorithm.

Complexity of Bucket Sort

Algorithm Complexity
Space O(1)
Worst Case O(n2)
Best Case Ω(n+k)
Average Case θ(n+k)

Algorithm

  • Step 1 START
  • Step 2 Set up an array of initially empty "buckets".
  • Step 3 Scatter: Go over the original array, putting each object in its bucket.
  • Step 4 Sort each non-empty bucket.
  • Step 5 Gather: Visit the buckets in order and put all elements back into the original array.
  • Step 6 STOP

Program


Next TopicComb Sort




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA