All Downloads are FREE. Search and download functionalities are using the official Maven repository.

slow.it.unimi.dsi.sux4j.mph.MinimalPerfectHashFunctionSlowTest Maven / Gradle / Ivy

Go to download

Sux4j is an implementation of succinct data structure in Java. It provides a number of related implementations covering ranking/selection over bit arrays, compressed lists and minimal perfect hashing.

There is a newer version: 5.4.1
Show newest version
package it.unimi.dsi.sux4j.mph;

import static org.junit.Assert.assertFalse;
import it.unimi.dsi.bits.LongArrayBitVector;
import it.unimi.dsi.bits.TransformationStrategies;

import java.io.IOException;
import java.util.Iterator;

import org.junit.Test;

public class MinimalPerfectHashFunctionSlowTest {

	@Test
	public void testBig() throws IOException {
		Iterable p = LargeLongCollection.getInstance();

		final LongArrayBitVector b = LongArrayBitVector.ofLength( LargeLongCollection.SIZE );
		final GOVMinimalPerfectHashFunction mph = new GOVMinimalPerfectHashFunction.Builder().keys( p ).transform( TransformationStrategies.fixedLong() ).build();
				
		for( Iterator i = p.iterator(); i.hasNext(); ) {
			final long pos = mph.getLong( i.next() );
			assertFalse( b.getBoolean( pos ) );
			b.set( pos );
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy