0
$\begingroup$

Implementation of bucket sort is mainly useful when input is uniformly distributed over a range. So the ques here is what is the significance of having input data uniformly distributed for applying bucket sort? What happens if this does not hold?

$\endgroup$
1
  • 1
    $\begingroup$ In the extreme case, if all numbers are very close, they'll fall into the same bucket, and bucketing will gain you nothing. $\endgroup$
    – user114966
    Apr 8, 2021 at 20:41

1 Answer 1

1
$\begingroup$

Bucket sort will be slower if the data distribution is highly non-uniform. The primary advantage of bucket sort over other sorting algorithm is that it is faster when the data is uniformly distributed; so if the data is highly non-uniformly distributed, the advantages of bucket sort may evaporate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.