using System.Collections.Generic;
using System.Collections;
public static void Main()
Bloom bloom = new Bloom();
bloom.checkFor("basketball");
bloom.checkFor("soccer");
private BitArray bits = new BitArray(32);
private Int16 rotateMore(String AddString)
for (int i = 0; i < AddString.Length; i++)
ReturnValue += (Int16)((int)AddString[i] * i);
ReturnValue = (Int16)(ReturnValue % 32);
private Int16 rotate(String AddString)
for (int i = 0; i < AddString.Length; i++)
ReturnValue += (Int16) ((int)AddString[i]);
ReturnValue = (Int16) (ReturnValue % 32);
public void add(String AddString)
Console.WriteLine("adding " + AddString);
Int16 Point1 = this.rotate(AddString);
Int16 Point2 = this.rotateMore(AddString);
this.bits[Point1] = true;
this.bits[Point2] = true;
public bool contains(String CheckString)
Int16 Point1 = this.rotate(CheckString);
Int16 Point2 = this.rotateMore(CheckString);
if (this.bits[Point1] && this.bits[Point2])
public void checkFor(String key)
Console.WriteLine(key + " may be in there");
Console.WriteLine(key + " is not there");