What is the difference between transverse and a longitudinal wave?

Longitudinal Waves: A wave where displacement/oscillation (of particles) is parallel to the direction of energy transfer.
a. Example: Sound waves
Longitudinal waves have areas of compression and rarefaction:
A compression is a region in a longitudinal wave where the particles are closest together.
A rarefaction is a region in a longitudinal wave where the particles are furthest apart.
Transverse Waves: A wave where displacement/oscillation (of particles) is perpendicular to the direction of energy transfer.
Examples: surface water waves, waves on a string, electromagnetic waves.