Created
April 9, 2017 18:08
-
-
Save nathankrishnan/1914841d9daa53bbea383a7cfa4c583c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BloomFilter<T> { | |
private var array: [Bool] | |
private var hashFunctions: [(T) -> Int] | |
public init(size: Int = 1024, hashFunctions: [(T) -> Int]) { | |
self.array = [Bool](repeating: false, count: size) | |
self.hashFunctions = hashFunctions | |
} | |
private func computeHashes(_ value: T) -> [Int] | |
public func insert(_ element: T) | |
public func query(_ value: T) -> Bool | |
public func isEmpty() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment