Skip to content

Instantly share code, notes, and snippets.

@chriswebb09
Created May 14, 2017 22:06
Show Gist options
  • Save chriswebb09/fd034148e2ae834c1c4c8df4052b26d5 to your computer and use it in GitHub Desktop.
Save chriswebb09/fd034148e2ae834c1c4c8df4052b26d5 to your computer and use it in GitHub Desktop.
struct HashTable<Key: Hashable, Value> {
typealias Bucket = [HashElement<Key, Value>]
var buckets: [Bucket]
init(capacity: Int) {
assert(capacity > 0)
buckets = Array<Bucket>(repeatElement([], count: capacity))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment