Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Bucket Sort
Bookmark
Input
Standard
Small
Clustered
Already Sorted
Reverse Sorted
Custom
arr
=
[64, 34, 25, 12, 22, 11, 90]
phase =
distribute
arr
0
1
2
3
4
5
6
b0: 0..0
64
34
25
12
22
11
90
phase =
distribute
arr
0
1
2
3
4
5
6
b0: 0..0
64
34
25
12
22
11
90
phase =
distribute
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
22
11
90
12
12
∈ [
11
..
37
] → bucket
0
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
34
>
25
?
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
34
>
12
→
shift right
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
34
>
22
?
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
key
22
settles at slot
1
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
25
>
11
→
shift right
phase =
sort
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
12
>
11
→
shift right
phase =
merge
buckets =
3
, width =
27
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
12
22
11
90
25
bucket
0
→ arr[
3
] =
25
arr
0
1
2
3
4
5
6
b0: 11..37
b1: 38..64
b2: 65..90
64
34
25
12
22
11
90
Array is sorted
algo
master
.
io
Step:
Start: sort the array with bucket sort
0 / 39
Input
Standard
Small
Clustered
Already Sorted
Reverse Sorted
Custom
arr
=
[64, 34, 25, 12, 22, 11, 90]
0 / 39
algo
master
.
io
Step:
Start: sort the array with bucket sort