     var description: String {
         return String(table)
     }
-    
-}
-
-
-struct HashTableNoChaining <K : NumericType, V> : CustomStringConvertible {
-    
-    private(set) var table  : [(key: K, value: V)?]
-    private(set) var hash   : K -> Int
-    
-    init(_ count : Int) { // convenience init
-        self.init(_: count, hash: { return Int($0 % K(count)) })
-    }
-    
-    init(_ count : Int, hash: K -> Int) {
-        table = [(key: K, value: V)?](count: count, repeatedValue: nil)
-        self.hash = hash
-    }
-    
-    mutating func insert(key key: K, value: V) throws {
-        try insert(element: (key, value))
-    }
-    
-    mutating func insert(element new: (key: K, value: V)) throws {
-        let h = hash(new.key)
-        if !table.range.contains(h) {
-            throw HashTableError.BadHashFunction
-        }
-        if table[h] != nil {
-            throw HashTableError.HashConflict
-        } else {
-            table[h] = new
-        }
-    }
-    
-    mutating func find(key key: K) throws -> (key: K, value: V) {
-        let h = hash(key)
-        if !table.range.contains(h) {
-            throw HashTableError.BadHashFunction
-        }
-        if let t = table[h] {
-            if t.key == key {
-                return t
-            }
-        }
-        throw HashTableError.NotInList
-    }
-    
-    mutating func remove(key key: K) throws -> (key: K, value: V) {
-        let h = hash(key)
-        if !table.range.contains(h) {
-            throw HashTableError.BadHashFunction
-        }
-        if let t = table[h] {
-            if key == t.key {
-                table[h] = nil
-                return t
-            }
-        }
-        throw HashTableError.NotInList
-    }
-    
-    mutating func changeHash(hash newHash: K -> Int) throws {
-        let oldHash = self.hash
-        let oldTable = self.table
-        do {
-            self.hash = newHash
-            self.table = [(key: K, value: V)?](count: oldTable.count, repeatedValue: nil)
-            for element in oldTable {
-                if element != nil {
-                    try insert(element: element!)
-                }
-            }
-        } catch _ {
-            self.hash = oldHash
-            self.table = oldTable
-            throw HashTableError.BadHashFunction
-        }
-    }
-    
-    var description: String {
-        return String(table)
-    }
-    
-}
-
-
-
+}
    }

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

        print("min: " + min + ", table.count: " + table.count)
    }
    
    func hash(key: Element) throws -> Int {
        var h = (hashFunction(key) % table.count)
        while h < 0 {
            h += table.count
        }
        h = h % table.count
        if 0 < h || h >= count {
            throw HashTableError.BadHashFunction
        }
        return h
    }
    
    internal mutating func changeBucketCount(buckets: Int) throws {
        try changeBucketCount(buckets, f: hashFunction)
    }
    
    internal mutating func changeBucketCount(buckets: Int, f: Element -> Int) throws {
        let oldHash = self.hashFunction
        let oldTable = self.table
        do {
            let newHash = f
            self.hashFunction = newHash
            self.table = [[Element]](count: buckets, repeatedValue: [])
            for bucket in oldTable {
                for element in bucket {
                    try insertNoCorrection(element: element)
