mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
@@ -93,7 +93,7 @@ class HashMapCuckooHashingTest {
|
||||
|
||||
private HashMapCuckooHashing createHashMapCuckooHashing() {
|
||||
HashMapCuckooHashing hashTable = new HashMapCuckooHashing(10);
|
||||
int[] values = { 11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222 };
|
||||
int[] values = {11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222};
|
||||
Arrays.stream(values).forEach(hashTable::insertKey2HashTable);
|
||||
return hashTable;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||
|
||||
import com.thealgorithms.datastructures.hashmap.hashing.MajorityElement;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.thealgorithms.datastructures.hashmap.hashing.MajorityElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MajorityElementTest{
|
||||
public class MajorityElementTest {
|
||||
@Test
|
||||
void testMajorityWithSingleMajorityElement() {
|
||||
int[] nums = {1, 2, 3, 9, 9, 6, 7, 8, 9, 9, 9, 9};
|
||||
@@ -42,7 +39,7 @@ public class MajorityElementTest{
|
||||
@Test
|
||||
void testMajorityWithEmptyArray() {
|
||||
int[] nums = {};
|
||||
List<Integer> expected = Collections.emptyList();
|
||||
List<Integer> expected = Collections.emptyList();
|
||||
List<Integer> actual = MajorityElement.majority(nums);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.thealgorithms.datastructures.hashmap.hashing;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
abstract class MapTest {
|
||||
abstract <Key extends Comparable<Key>, Value> Map<Key, Value> getMap();
|
||||
|
||||
Reference in New Issue
Block a user