 
 import Foundation
 
-public class Heap<T where T: Comparable, T: Hashable> {
+public class MinHeap<T: Hashable, W: Comparable> {
 	private var array = [T]()
+	private var weights = [W]()
 	private var elementsToPositions = Dictionary<T, Int>()
 	
 	private func _parentIndex(index: Int) -> Int {

		
		let minimum = array.first!
		array[0] = array[array.count - 1]
		array.removeAtIndex(array.count - 1)
		
		elementsToPositions.removeValueForKey(minimum)
		

		}
	}
	
	private func _swapElements(a: Int, _ b: Int) {
		let elementA = array[a]
		let elementB = array[b]
		
		let weightA = weights[a]
		let weightB = weights[b]
		
		array[a] = elementB
		array[b] = elementA
		
		weights[a] = weightB
		weights[b] = weightA
		
		elementsToPositions[elementA] = b
		elementsToPositions[elementB] = a
