Computation of Shock Waves in Cavitating Flows