Adiabatic quantum algorithms as quantum phase transitions: First versus second order