 }
 
 public func heapSort(inout array: [Int]) {
-	var heap = Heap<Int>()
+	var heap = MinHeap<Int, Int>()
 	
 	for element in array {
-		heap.insert(element)
+		heap.insert(element, weight: element)
 	}
 	
 	for n in 0..<array.count {

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

		return array.count == 0
	}
	
	public func insert(element: T, weight: W) {
		array.append(element)
		weights.append(weight)
		elementsToPositions[element] = array.count - 1
		
		_heapifyUp(array.count - 1)
	}
	
	public func update(element: T, weight: W) {
		if let index = elementsToPositions[element] {
			weights[index] = weight
			_heapifyUp(index)
		}
	}
	
