Skip to content

Commit

Permalink
Fix issue with broken hash functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ossner committed Aug 9, 2020
1 parent ec1c32d commit aabcc25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Algorithms/Hashing/Double/DoubleHashing.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DoubleHashing {
"%$DHTABLE$";

/**
* generates a first hashfunction matching /\([1-9]x \+ 9\) mod 11/
* generates a first hashfunction like ([1-9]x + 9) mod 11
*/
public static int[] generateH1Function() {
Random rand = Terminal.rand;
Expand All @@ -38,7 +38,7 @@ public static int[] generateH1Function() {
* h2(x) = prime1 - (x % prime2)
*/
static int[] generateH2Function() {
int[] primes = {5, 7, 11};
int[] primes = {3, 5, 7};
Random rand = Terminal.rand;
int[] a = new int[2];
a[0] = primes[rand.nextInt(3)];
Expand Down Expand Up @@ -82,7 +82,7 @@ public static void generateExercise() {
secondInsertions[i] = deletionsArr[k++];
}

ArrayList allInsertions = new ArrayList(Arrays.asList(firstInsertions));
ArrayList<Integer> allInsertions = new ArrayList<>(Arrays.asList(firstInsertions));
for (int i = 0; i < numOfSecondInsertions; i++) {
allInsertions.add(secondInsertions[i]);
}
Expand Down

0 comments on commit aabcc25

Please sign in to comment.