Skip to content

Commit cb60d4c

Browse files
committed
Fix links in javadoc for ArrayOfAges & BucketSort. Fix typo, add var
1 parent a900118 commit cb60d4c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/by/andd3dfx/sorting/ArrayOfAges.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
/**
77
* We have a very long array of people ages.
88
* Need to count number of people for each age.
9+
*
10+
* @see <a href="https://youtu.be/vFsDPm7ecsM">Video solution</a>
911
*/
1012
public class ArrayOfAges {
1113

src/main/java/by/andd3dfx/sorting/BucketSort.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* @see <a href="https://www.youtube.com/watch?v=vFsDPm7ecsM">Video solution</a>
8-
*/
96
public class BucketSort {
107

118
private static final int BUCKETS_COUNT = 10;
@@ -19,7 +16,8 @@ public static <T extends Comparable> void apply(T[] items) {
1916

2017
// Fill in buckets
2118
for (int i = 0; i < items.length; i++) {
22-
buckets.get(determineBucketIndex(items[i], BUCKETS_COUNT)).add(items[i]);
19+
var bucketIndex = determineBucketIndex(items[i], BUCKETS_COUNT);
20+
buckets.get(bucketIndex).add(items[i]);
2321
}
2422

2523
int currIndex = 0;
@@ -30,7 +28,7 @@ public static <T extends Comparable> void apply(T[] items) {
3028
Comparable[] array = bucket.toArray(new Comparable[0]);
3129
InsertionSort.apply(array);
3230

33-
// Populate result array with values from bucket
31+
// Populate the result array with values from bucket
3432
for (var item : array) {
3533
items[currIndex] = (T) item;
3634
currIndex++;

0 commit comments

Comments
 (0)