private void heapifyDown(int parentId) {
		if (parentId <= 0 && parentId >= length) {
			return;
		}
		
		int left = 2*parentId;
		int right = 2*parentId + 1;
		
		if (right < length) {
			//left is smaller
			if (heap[left].compareTo(heap[right]) < 0) {
				if (heap[parentId].compareTo(heap[left]) > 0) {
					switchTwo(parentId, left);
					heapifyDown(left);
				}
			}
			//right is smaller
			else {
				if (heap[parentId].compareTo(heap[right]) > 0) {
					switchTwo(parentId, right);
					heapifyDown(right);
				}
			}
		}
		else if (left < length) {
			if (heap[parentId].compareTo(heap[left]) > 0) {
				switchTwo(parentId, left);
				heapifyDown(parentId/2);
			}
		}
	}