ソートアルゴリズムAdvanced

Bucket Sort

A distribution-based sorting algorithm that distributes elements into a number of buckets. Each bucket is then sorted individually using another sorting algorithm. Works best when input is uniformly distributed over a range. Average time complexity is O(n+k).

#sorting#distribution-sort#linear-time#non-comparison

Complexity Analysis

Time (Average)

O(n + k)

Expected case performance

Space

O(n + k)

Memory requirements

Time (Best)

O(n + k)

Best case performance

Time (Worst)

O(n²)

Worst case performance

📚 CLRS Reference

Introduction to AlgorithmsChapter 8Section 8.4

Input Array

Implementation

Bucket Sort - Algorithm Vision