when the displaced particles are perpendicular to the direction the wave travels, is called a transverse wave, whereas in longitudinal wave the displace practices are parallel to the direction of the wave.
in the given image:
first image shows - longitudinal wave
second image shows - transverse wave
third image shows - longitudinal wave
fourth image shows - longitudinal wave