     }
 
     
-    mutating func hash(newHash: K -> Int) throws {
+    mutating func hash(newHash: Element -> Int) throws {
         let oldHash = self.hashFunction
         let oldTable = self.table
         do {
             self.hashFunction = newHash
-            self.table = [[(key: K, value: V)]](count: oldTable.count, repeatedValue: [])
+            self.table = [[Element]](count: oldTable.count, repeatedValue: [])
             for bucket in oldTable {
                 for element in bucket {
                     try insert(element: element)


import Foundation

struct HashTable <K : Hashable, V> : CustomStringConvertible {
    
    private(set) var table          : [[(key: K, value: V)]]
    private(set) var hashFunction   : K -> Int
    
    init(_ f: K -> Int) {
        self.init()
        hashFunction = f
    }
    
    init(_ array: [(K, V)]) throws {
        self.init()
        for v in array {
            try insert(element: v)
        }
    }
    
    init(_ array: [(K, V)], buckets: Int) throws {
        self.init(buckets)
        for v in array {
            try insert(element: v)

            print("did end because tc * 2 < 5: " + table.count)
            return
        }
        if max > count / tc {
            print("increasing bucket count!")
            try changeBucketCount(tc)
        }
