Converting Dictionary into heap