Skip to content

Instantly share code, notes, and snippets.

@lovromazgon
lovromazgon / Apriori.java
Last active February 17, 2021 21:12 — forked from monperrus/Apriori.java
Java implementation of the Apriori algorithm for mining frequent itemsets - using multiple threads (default 8)
import java.io.*;
import java.util.*;
/** The class encapsulates an implementation of the Apriori algorithm to compute frequent itemsets.
*
* This version uses multiple threads to go through the dataset and is therefore 3x faster than the 1 thread version.
*
* Notice: To enable progress tracking (CLIProgressBar) follow these steps:
* 1. download this class and put it on the classpath: https://gist.github.com/lovromazgon/9c801554ceb56157de30
* 2. uncomment lines 229 and 243
@lovromazgon
lovromazgon / Rabbit.java
Last active February 9, 2019 15:52 — forked from Chase-san/Rabbit.java
Rabbit Stream Cipher
/**
* @see {@link http://tools.ietf.org/rfc/rfc4503.txt}
*/
public class Rabbit {
private static final int[] A = new int[] { 0x4D34D34D, 0xD34D34D3, 0x34D34D34, 0x4D34D34D, 0xD34D34D3, 0x34D34D34, 0x4D34D34D, 0xD34D34D3 };
private static final long MAX_UNSIGNED_INT = Integer.MAX_VALUE * 2l + 2; //2^32
private static final boolean DEBUG = false;
private int[] X;
private int[] C;