What is the advantage of a switching over a linear power supply?
The answer to which one you use depends on the application, and the efficiency needs.

For example, you're asked to make a phone charging dock. The dock is powered via a 12 V wallwart, and powers the phone with 5V of power at 500mA. Using a linear regulator, 3.5W is dissipated.That's quite a bit of waste, but you're connected to the mains, and a charging dock is a big enough device, where a properly heat sunk regulator wouldn't cause a lot of heating issues. 

On the flip side, suppose you're building a wearable device that operates on a small Li-Po battery, even if you designed a LDO circuit that only wastes about 1W of power, a switching circuit would be more desirable as if designed properly, you could reduce your wastage to &lt;10% that of the linear regulator

Note: Pay attention to the efficiency curves of switching regulators. They normally only have high efficiency for small ranges of current usage, and it helps to understand what current usage your application operates on in different condition to design the most efficient power circuit. Also - laying out swtiching regulators on a PCB can be hit/miss - I've seen a lot of incidents where tiny layout issues can mess with the desired voltage out.